Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

i need to have this directory, which is created under FTP User1:

/home/User1/public_html/jobs_html

readable by a different FTP user, call them User2 ...

ie, when logged in thru SSH under User2, 'ls -l /home/User1/public_html/jobs_html' needs to display files

thanks!

share|improve this question

migrated from stackoverflow.com Jun 7 '11 at 2:17

This question came from our site for professional and enthusiast programmers.

2 Answers 2

Create a new group, add both of these users to that group, set group rw on the common directory and make that group owner of the directory.

share|improve this answer
    
Allowing user2 access to /home/User1/public_html/jobs_html/ implies giving them access to /home/User1/public_html/ and /home/User1/ which may not be desirable - a better solution might be to move this directory elsewhere and add symbolic links. Also, in addition to setting the group ownership on the shared directory, you should set the setgid bit on the directory too. –  symcbean Jun 7 '11 at 10:36

In addition to setting group ownership and group rw on the directory, I would also suggest setting the setgid bit on the directory so subdirectories created retain the same correct group ownership rather than being owned by the user who created them.

# EDIT: Make sure user2 can list files in user1's home dir
chmod o+x /home/user1

# Set ownership
chown -R user1.sharedgroup /path/to/shared
chmod -R g+rw /path/to/shared
chmod g+s /path/to/shared

# Or if subdirectories already exist, setgid for all subdirectories
find /path/to/shared -type d -exec chmod g+s {} \;
share|improve this answer
    
already did that, still when i login under user2 in ssh and go 'ls -l /home/user1/public_html/jobs_html' says 'permission denied' .... –  sam Jun 7 '11 at 16:20
    
for the first command, do i do that under root as user1.sharedgroup or root.sharedgroup? the directory belongs to user1 and sharedgroup but still says 'permission denied' for user2 –  sam Jun 7 '11 at 16:21
    
@sam I think you need to be root to execute the first command. But you want it owned as user1.sharedgroup. It's likely that user2 can't get in because he doesn't have execute permissions on /home/user1 to be able to list the directory contents and enter accessible directories below it. See edits above... –  Michael Jun 7 '11 at 16:27
    
the directories /public_ftp are shared on the account (it's same place as public_html) ... maybe i can somehow copy permissions? tried cp -p didn't work –  sam Jun 7 '11 at 16:48
    
@sam please post the ls -l of /home, /home/User1 and /home/User1/public_html –  Michael Jun 7 '11 at 17:10

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.