两个用户之间的命令只能由root用户执行。su root
(or)
sudo su
可以通过以下命令在两个用户之间复制文件。cp /home/user1/location_of_the_files /home/user2/location_to_paste_file
可以通过以下命令在两个用户之间移动文件。mv /home/user1/location_of_the_files /home/user2/location_to_paste_file
另外一种方法:# As user1, mv or cp to your home dir (alternative /tmp):
mv /home/user1/path/to/location_of_the_files /home/user1/
# Give user2 access to read files and read and access directories
setfacl -R -m u:user2:rX /home/user1/location_of_the_files
# Login as user2
su user2
cp -r /home/user1/location_of_the_files ~/
# Back to user1:
# delete the directory if you wanted it moved
# or move it back to the original location and remove the facl using:
setfacl -Rbn /home/user1/location_of_the_files
如果安装了SSH服务器并启用了SSH,则更容易:# As user2
scp -r user1@localhost:/home/user1/path/to/location_of_the_files/ ~/
相关文章