[H-GEN] weird permissions problem

Troy Piggins troy at piggo.com
Sun Jan 10 19:23:53 EST 2010


Trying to add a new user to our linux server this morning, brain not
in full gear after the Christmas break, and I seemed to have stuffed
something up pretty good.

I have a little script I'd written to help automate it a little[1],
but I forgot to add the username as an argument.  Realised after the
script had started, tried hitting ctrl-c a few times to stop it.
Think that has broken something.

Now it seems that no users can access their home dirs, and
permissions for all existing users aren't behaving as I'd expect.

I've attached extract of /etc/passwd[2] and /etc/group[3].

When I try to ssh into the server, I get "Permission denied" erros
and can't cd to my home dir, but I can log in and it puts me in the
root dir:

 ----------------------------------------------------------------
 $ ssh dataserv
 <snip />
 -bash: /home/troy/.bash_profile: Permission denied
 troy at dataserv:/$ 
 ----------------------------------------------------------------

If I list the permissions on my home dir, it all appears as it
should:

  ----------------------------------------------------------------
  # ls -l /home | grep troy
  drwx------ 61 troy        staff 4096 2010-01-11 08:39 troy
  ----------------------------------------------------------------

And my bash_profile permissions look fine too:

  # ls -l /home/troy/.bash*
  -rw------- 1 troy staff 8077 2009-12-25 20:33 /home/troy/.bash_history
  -rw-r--r-- 1 troy staff  220 2007-03-03 04:01 /home/troy/.bash_logout
  -rw-r--r-- 1 troy staff  414 2007-03-03 04:01 /home/troy/.bash_profile
  -rw-rw-r-- 1 troy staff 1052 2008-09-15 18:40 /home/troy/.bashrc
  ----------------------------------------------------------------

Any ideas?  I'm stumped.

[1] /home/troy/bin/add_staff.sh
  ----------------------------------------------------------------
  #v+
  #!/bin/bash
  
  NEW_USER=$1
  
  sudo groupadd $NEW_USER
  sudo useradd -g staff -G $NEW_USER -m $NEW_USER
  sudo chmod go-rx /home/$NEW_USER/
  sudo passwd $NEW_USER
  
  sudo smbpasswd -a $NEW_USER
  
  sudo vim /home/$NEW_USER/signature.txt
  #v-
  ----------------------------------------------------------------

[2] /etc/passwd
  ----------------------------------------------------------------
  #v+
  troy:x:1003:50:Troy Piggins,,,:/home/troy:/bin/bash
  #v-
  ----------------------------------------------------------------

[3] /etc/group
  ----------------------------------------------------------------
  #v+
  adm:x:4:troy
  dialout:x:20:cupsys,troy
  cdrom:x:24:haldaemon,troy
  floppy:x:25:haldaemon,troy
  audio:x:29:troy
  dip:x:30:troy
  video:x:44:troy
  plugdev:x:46:haldaemon,troy
  staff:x:50:troy
  lpadmin:x:109:troy
  scanner:x:111:cupsys,hplip,troy
  troy:x:1009:troy
  #v-
  ----------------------------------------------------------------

-- 
Troy Piggins



More information about the General mailing list