[comp.os.minix] 'passwd' problems

mcormick@unm-la.UUCP (Patrick McCormick) (02/01/89)

	I just got MINIX running on a hard disk and things were
	fine one of the users tried to change their password.
	Here's what happens...


		$ passwd 

	This takes the user(s) through the prompts for old, new, and
	retype (or just new and retype).  But, after a RETURN one of
	follow error messages pops up :

		Can't create temporary file

	--or--
		
		Can't recreate password file

	The second message popped up after I had changed the permissions
	on /etc due to the first message. 

	I finally decided to test the version on a backup disk and, when
	I ran passwd on the floppy, the command worked and I did not get
	any errors. (????)  So, what it boils down to is that I can get
	passwd to work (all the time) on floppy but, it crashes when I
	run it off the hard drive.


	Has anyone had this trouble before?  Any ideas?


	I appologize if this is an old problem that was posted long ago
	I've just recently started into MINIX.


	Thanks,


	Patrick McCormick
	mcormick@unm-la.LANL.GOV
	lanl!unm-la!mcormick@uunet.uu.net
	-- or --
	uunet.UU.NET!unm-la!mcormick@cs.utexas.edu

pa1343@sdcc15.ucsd.edu (pa1343) (02/01/89)

In article <1062@unm-la.UUCP> mcormick@unm-la.UUCP (Patrick McCormick) writes:
>		Can't create temporary file
>		Can't recreate password file
>
>	The second message popped up after I had changed the permissions
>	on /etc due to the first message. 
The problem here is that /bin/passwd must be owned by root and the SUID 
bit must be set with the following commands.
# chown root /bin/passwd
# chmod 4755 /bin/passwd

note here that you must be super-user to do this.  Afterward, the permissions
above will give the passwd command root privilige required to edit /etc/passwd.

---------------
John J. Marco
pa1343@sdcc15.ucsd.edu
---------------

dcripe@mcdurb.Urbana.Gould.COM (02/01/89)

Looks like you lost the setuid bit on /etc/passwd when you copied it.
/etc/passwd must be setuid so that it can write to the password file.
There are a number of other programs that must be setuid, and you may
have lost the bit on these, also.

dcd@tc.fluke.COM (David Dyck) (02/04/89)

In article <1062@unm-la.UUCP> mcormick@unm-la.UUCP (Patrick McCormick) writes
about the passwd program not working correctly except from distrubution floppy:

Try

$ su
# cd /usr/bin		# or whereever the passwd program is located
# chown root passwd
# chmod passwd 4775

This makes it suid root.

            David Dyck
    Domain: dcd@tc.fluke.COM
      UUCP: {uw-beaver,decwrl,microsof,sun}!fluke!dcd

kenf1@aplcen.apl.jhu.edu (Ken Firestone) (02/04/89)

In article <6833@fluke.COM> dcd@tc.fluke.COM (David Dyck) writes:
>In article <1062@unm-la.UUCP> mcormick@unm-la.UUCP (Patrick McCormick) writes
>about the passwd program not working correctly except from distrubution floppy:
>
>Try
>
>$ su
># cd /usr/bin		# or whereever the passwd program is located
># chown root passwd
># chmod passwd 4775
>
>This makes it suid root.
This might not work.  I had the problem with passwd, and a 
similar problem with su, su would not allow me to become
root, even when I gave it the correct password and all. 

I am guessing that the problem started when I logged in as 
ast, and copied files from floppy to hard disk.  In the process
ast wound up owning everything, and I had the above problem.  I 
solved it by logging in as root, and then doing the above. 

I do have two questions:

	1. What other files HAVE to be owned by root and
	have the suid set?

	2. How do you tell if suid is set?

		Thanks

		Ken Firestone (kenf1@aplcen.apl.jhu.edu)

willy@idca.tds.PHILIPS.nl (Willy Konijnenberg) (02/06/89)

In article <653@aplcen.apl.jhu.edu> kenf1@aplcen.apl.jhu.edu (Ken Firestone) writes:
>In article <6833@fluke.COM> dcd@tc.fluke.COM (David Dyck) writes:
>>In article <1062@unm-la.UUCP> mcormick@unm-la.UUCP (Patrick McCormick) writes
>>about the passwd program not working correctly except from distrubution floppy:
>
>	1. What other files HAVE to be owned by root and
>	have the suid set?
>
>	2. How do you tell if suid is set?

Ok, this seems to be a common problem.
Here is a list of programs that need to be setuid root:
(maybe incomplete, anybody know what I forgot?)

	df
	login
	mkdir
	passwd
	su

When correctly set, an ls -l says:

	-rwsr-xr-x   1 root    ...
	   ^

To correct it, log out, then login as root and type

	chown root <program>
	chmod 4755 <program>

Note that when your login and su are not setuid root, you cannot
use them to become super user. Only when login is started by init
or when it is setuid root, it has the super-user privileges that
it needs to properly log you in.

Please everybody, check your installation. When you usually work
as root (as I did), you may have never noticed the problem.

-- 
	Willy Konijnenberg		<willy@idca.tds.philips.nl>