3

I added a user called 'kma' to root group. Then I changed permission of /root/ to 770. Which should give the user read, write and execute access since I added him to the root group. But it still gives permission denied error. What am I doing wrong here?

Commands I executed:

sudo adduser kma root
sudo chmod 770 /root/
cd /root/ <------- Gives permission error
  • 1
    1) You're not running as kma - unless you omitted the logout / login, 2) you just removed all permissions for "other" to deal with /root/, so the current user must be the owner, or in the appropriate group. – Attie Jul 11 at 21:38
  • I can confirm that I am running as kma and I have logged out and logged back again. – KMA Badshah Jul 11 at 21:59
  • -bash: cd: /root: No such file or directory – Victor VosMottor thanks Monica Jul 12 at 10:49
  • @Attie They actually probably added group permissions. The default (and correct for security reasosn) permissions for /root on pretty much all Linux distributions are 0700. – Austin Hemmelgarn Jul 12 at 12:45
  • @KMABadshah Did you actually log out, or just close and re-open a terminal window in the same desktop session? It's not my area of expertise, but I've seen posts that suggest opening a new shell/terminal window isn't logging-in... it's just a new instance of bash/whatever running under your existing login. – TripeHound Jul 12 at 13:10
5

Make sure that you have logged out and logged back in again, else the group change won't apply. Other than that, what you have written works for me.

| improve this answer | |
1

Odd enough for me that I had to restart my computer in order to get the permissions all set up. Anyway, it works fine now

| improve this answer | |
  • Please mark an answer as accepted – clemisch Jul 12 at 13:52
  • That's just how Unix permissions work. It can't update group memberships while the user is logged in, so it requires logging out and logging back in at least (I tend to do full reboots just to be sure). – Tim Schumacher Jul 13 at 16:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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