Jump to content

Need Help with Raspbian SFTP Permission (Noob)

Hello,

I'm doing a bit of work on an SFTP server as my way of noodling around with Linux for the first time! I'm having fun with it so far, but I ran into a bit of trouble. I have a handful of users and groups, and I'm trying to get them exclusive permissions to their namesake directories on a USB hard drive. Directories are all set on the hard drive, groups are arranged how I want them. I'm just wondering how I address specific groups when I give them permissions for directories. So far I found: 


sudo chmod g+rwx /media/pi/PiCloud/guest


I understand that this gives the group read, write, and execute permissions to that directory, which is what I want, but how do I specify which group I'm granting that to? I want to give group "guest" the above permissions. 

In case it's important, I'll list all users and groups bellow:
User: pi   --belongs to groups: pi, morgan, jordan, ryan, administration, eryn, guest
User: jordan  --belongs to groups: administration, guest, jordan
User: eryn  --belongs to groups: eryn, guest
User: morgan  --belongs to groups: morgan, guest
User: ryan  --belongs to groups: ryan, guest
User: guest  --belongs to group: guest

I have folders in my hard drive called:
Administration
Eryn
Guest
Jordan

Morgan
Ryan

So I'm trying to get each user/group permission to rwx their name-sake directories, but I as pi need to be able to have access too. Is it possible to do this with the above example, or am I way off base?

If I haven't triggered you too hard with my sheer ignorance, I'd really appreciate some pointers!

Thanks, and let me know if you need more clarification. 

Link to comment
Share on other sites

Link to post
Share on other sites

Every file/folder on UNIX has an user:group permission set, but can also have a single user or a single group
For example

-rw-r--r-- 1 foo:bar FOLDER1 tells us that FOLDER1 belongs to foo(user):bar(group)
let's say in /etc/group you got this
 

bar:x:1:user1,user2,user3

those 3 users belonging to the bar group can has the overall group permission

depending on the SECOND permission set you got on that file, you have only the r as you can see in the second file permission, -rw-r--r-- means the group you specified can only read access

So, TL;DR
that file/folder you want to give access to the guest group you need to "sudo chown *user*:guest *filename*" and then you need to set the second permission set with chmod
image.png.5752bd31fddd7c812e971b58130ce8e5.png

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×