Find the answer to your Linux question:
Results 1 to 4 of 4
Hi all, I am working in a lab where it is often useful to copy folders from one user's home directory on a machine to another user's on the same ...
  1. #1
    Just Joined!
    Join Date
    May 2008
    Posts
    1

    Copying files between users

    Hi all,

    I am working in a lab where it is often useful to copy folders from one user's home directory on a machine to another user's on the same machine. I think a simple cp does not work because of permission errors. What is the easiest way to do this?
    Thanks!
    Cameron

  2. #2
    Linux Guru Jonathan183's Avatar
    Join Date
    Oct 2007
    Posts
    2,941
    Have you tried using cp to copy the folder and then chown to change owner?
    If you regularly need to share information you could also try setting up a folder and allow all read/write access ... then the users could copy the information rather than root.

  3. #3
    Just Joined!
    Join Date
    Jul 2007
    Posts
    49
    You could use sudo cp /home/usera/file /home/userb/
    as long as you have permissions to run sudo cp (set in the sudoers file) then chown the moved file

  4. #4
    Linux Guru
    Join Date
    Nov 2007
    Location
    Córdoba (Spain)
    Posts
    1,513
    sshfs is my choice, for both local or remote mounts. It doesn't matter.

    For example, if I am the user i92guboj, I can mount the home dir of the user clara under my home this way:

    Code:
    sshfs clara@server:/home/clara ~/clara/
    The general schema is:

    Code:
    sshfs <user>@<server>:</home/dir/server/side> ~/local/mount/point/
    It doesn't matter if you do it in a local or remote machine. In any case, the server needs to be running the ssh daemon, of course.

    If you setup passwordless authentication for ssh, then you will not need to enter keys to mount the directory.

    The advantage is that, on the client side, the files will seem as owned by you, and on the server side, the files will be seen as owned by the user that you used to login (clara in my example). So, no one suffers, and the exchange is still secure.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...