2

-edit- i figured it out. I needed to use adduser username group instead.

I added a user with the command

useradd -G myapp_user newusername

then i changed the group on the public folder that i want the user to access. Here is the line using ls -l I see the group has been set.

drwxrwxr-x 3 root myapp_user 4096 Jul  9 19:13 public

I cd into it and do it again to and i see files like the below with the group. I also see rwx on both the public folder and on the content inside the directory.

-rwxrwxr-x 1 root myapp_user   4403 Oct 10  2007 info.png

Then i login as the user and CD into the folder i wrote touch a and i got a permission error. I cant add, delete or do anything even though i see 775 is the permission. I also tried useradd -G myapp_user newusername to find the user is already part of the group

what am i missing? am i suppose to flush something before it takes effect? restart something? why cant the user modify anything in the public folder?

using putty and winscp. But right now just putty.

-edit- i wrote id newusername and got the below. Why isnt the groupname included?!

uid=1000(newusername) gid=1000(newusername) groups=1000(newusername)
2
  • 1
    Go ahead and put your edit in as an answer, then you can accept that. Makes things a bit easier to follow when someone views the question.
    – squillman
    Jul 10, 2010 at 5:47
  • Please do id -a newername so that all groups are visible. From the basic output provided, it would appear that newusername does not have myapp_user as a group. Between the group changes, I hope that you logged out and then logged in as the group membership is populated only at login.
    – mdpc
    Jul 10, 2010 at 6:26

4 Answers 4

1

You setup the groups correctly, but the user's list of groups is set when they first login, and won't normally ever be re-evaluated. If you make a change to a user's list of groups, you either need to log out and log back in, or you need to run the newgrp command.

0

Put the newusername into the myapp_user group with gpasswd -a newusername myapp_user. You should close any open session for newusername and perform a new login for the new group to be effective.

0

use adduser username group instead

0

After using user274's answer: Have you set the folder permissions? You must set it for letting members modify items be modified by the owner, group members or everyone.

I suggest you to use an chmod calculator and after that, use the command below:

chmod -R XXX .
  • "-R" is the flag for "Recursively set these permissions". Optional.
  • "XXX" is the chmod you got on the calculator
  • "." is the current directory. You can indicate replace it with your absolute path where you can apply the permissions.

That way i could upload files with my username on SFTP to certain folder that i has no permission before. Beware: setting 7 for Everyone could be dangerous for your system, so use with this with security in mind.

You must log in to answer this question.