In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article shows you how to copy files between different users in Linux, the content is concise and easy to understand, it will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.
We all know that the Linux system is a multi-user system, and it is possible to use multiple users to work at the same time, so what if you copy files between different users?
Method 1: first log in with the foo user, copy the files to the system temporary directory / tmp, then switch to the bar user, and then copy the files from the system temporary directory / tmp to your own home directory. Why use cp instead of mv here? Because the file copied to / tmp is owner or foo, by default other users have read permission and no write permission (naturally no move permission). Even by changing the file permissions to make bar writable, moving to the home directory of bar, owner is still foo, and only root can be changed to bar. This method is a bit tortuous, and the disadvantages are obvious. the file needs to be copied twice and takes twice as long.
# cp file.txt / tmp/ # su-bar # cp / tmp/file.txt ~ / # exit # rm / tmp/file.txt method 2: use the scp command. Originally, scp is used to use copy files on different hosts through the network, which happens to be used here. Log in with the bar user
# scp foo@localhost:/home/foo/file.txt. / enter the foo user password to start the file transfer. You can also log in as a foo user
# scp file.txt bar@localhost:/home/bar/ enter the bar user password, the process is the same.
Which method is used in practice depends on your personal preference. If the file size of the copy is small, the first method is also an option.
What is Linux system Linux is a free-to-use and free-spread UNIX-like operating system, is a POSIX-based multi-user, multi-task, multi-threaded and multi-CPU operating system, using Linux can run major Unix tools, applications and network protocols.
The above is how to copy files between different users in Linux. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.