Weird SSH problem... Any ideas?!?

Erik Norgaard norgaard at math.ku.dk
Fri Oct 21 07:17:07 PDT 2005


On Fri, 21 Oct 2005, Olaf Greve wrote:

>> I think you can use mtree to get permissions right if they for some reason 
>> have been changed.
>
> This might be a good one to check... I'm not familiar with it yet, but does 
> this check all permissions and ownerships and corrects errors/mismatches 
> where possible?

It does a lot of stuff, depending on the options you give - better 
read the man page first. It can create directories accidentially 
deleted and should set permissions, but does not edit files.

>> Another effect I would suspect you see - that is normal users see - is that 
>> files' owner and group appears as numbers not the corresponding names. One 
>> interesting thing here is whether both user and group are numbers or only 
>> users.
>> 
>> Try as normal user to 'ls -l /home' or something.
>
> Now the plot thickens...
> When doing this as the user abcdef which has UID 1026 I get the following 
> results:
> -Stuff owned by root -> root:wheel
> -Stuff owned by abcdef -> 1026:www
>
> When doing this as my normal user that is in the wheel group I get the same 
> results, but when I do it as root I get the correct results:
> -Stuff owned by root -> root:wheel
> -Stuff owned by abcdef -> abcdef:www
>
> When doing some more investigative work, I made the following observations:
>
> Consider the following (properly modified for anonymity) parts of 
> /etc/passwd:
> Ava:*:1001:1001:User &:/home/Ava:/bin/sh
> abcdef:*:1026:1002:User &:/home/abcdef:/bin/sh
>
> Idem for /etc/group:
> www:*:80:
> nogroup:*:65533:
> nobody:*:65534:
> mysql:*:88:
> Ava:*:1001:
> wwwuser:*:1002:Ava,olafo
>
> Now, when logging in as user abcdef (either using SSH or 'login' from the 
> shell as you suggested), for some users the above scenario happens, where 
> e.g. the stuff owned by abcdef appears as: 1026:www
>
> Then, when checking stuff owned by Ava, it shows up as being owned by 
> Ava:wheel !!!
>
> Also, when trying to perform on e.g. a file called a.bcd (owned by 1026:www):
> chown abcdef a.bcd -> error message: "Invalid argument"
> chown 1026 a.bcd -> success
> chown Avalanche a.bcd -> error message: "Operation not permitted"
>
> Sounds like the problem only occurs for some users...
>
> I'm completely puzzled now... Does anyone see anything dodgy in my 
> /etc/passwd and/or /etc/group definitions???
> Any solutions??

Your group is ok, but there's something squerry with the password 
files. It might be a good idea to take a backup of what you have 
and then see if you can regenerate it.

If you edit the master.passwd file with say vi the other files are 
not updated. First thing, try this:

# cd /etc
# pwd_mkdb master.passwd
# pwd_mkdb -p master.passwd

If it doesn't work then I suggest you start adding users from 
scratch again.

IIRC you can find the installation master.passwd file in 
/usr/src/etc alternatively

# cd /usr/src
# make -DESTDIR=/tmp distribution

will create directories etc and boot under /tmp from there you can 
copy new "virgin" files to your /etc.

Cheers, Erik




More information about the freebsd-questions mailing list