I am facing the below problem in linux kernel 2.6.18-7.1

  1. I created user "BBC" using adduser -D after this /etc/passwd contains "BBC:x:1010:1010:Linux User,,,:/home/BBC:/bin/sh"

  2. I created group "BBCGROUP" using addgroup BBCGROUP

  3. added the user "BBC" to the group "BBCGROUP" using addgroup BBC BBCGROUP after this etc/group contains



  4. then created the directory mkdir /usr1 [ as root ]

  5. I created file /usr1/test.txt by using echo "hello" > /usr1/test.txt

  6. ls -l /usr1 gives "-rwxrwx--x 1 root root 5 Sep 5 14:01 test.txt"

  7. chmod -R 771 /usr1

  8. chown -R :BBCGROUP /usr1.

After this I expect, user "BBC" able to read/write/execute files under /usr1 .

Now "ls -l /usr1 " gives -rwxrwx--x 1 root BBCGROUP 5 Sep 5 14:03 test.txt 9)I changed the user to "BBC" by "su -s /bin/sh BBC" 10) id command shows uid=1010(BBC) gid=1010(BBC) 11) cd /usr1 12) I tried to modify the file echo "HELLO1" > test.txt or touch test.txt I getting error as "sh: can't create /usr1/test.txt: Permission denied" for user BBC.

This is the basic problem, I am facing in embedded system, any solution for this. Any configuration need to be changed? Same thing working fine in desktop linux. Any info please to solve this.

migrated from stackoverflow.com Sep 6 '11 at 13:29

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

  • You really need to format that before I try to read it anymore. – Jeff Ferland Sep 6 '11 at 11:25
  • Any particular reason your not using the tools for this, even if your just running a script post install? For example how are you ensuring shaddow is correctly setup? – stsquad Sep 6 '11 at 11:44
  • Out of curiosity, does the man page for passwd have the following restriction on the username field? "It should not contain capital letters." – Xenoactive Sep 6 '11 at 17:38

You may try to use the newgrp BBCGROUP command before entering the directory.

Alternatively, you may want to change the default group for this user to BBCGROUP instead of BBC. Maybe the addgroup utility can do it (I have some other flavour of utilities here, so I am not sure), or you can manually change the second :1010: to :9: in the /etc/passwd file (carefully!).

And by the way, this question seems to be more appropriate to https://superuser.com/ or (better:) https://unix.stackexchange.com/ I suppose.

Your Answer

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