changing user in a shell script
hi all,
Is ther any way to change the user from a shell script without getting out of the script |
I think su should work. Like su otheruser, or su - otheruser
|
i know the command for changing user is su or sys .but su ask for a password so i cant use it. meanwhile for "sys -lu username" even though it switches user ,iam not able to run any commands as that user .
|
Aha, but I don't think it is possible to change user without giving a password as other than root... Maybe you could use ssh, and set up public key authentication? See here.
|
You can run files as the owner of the file if you set the permissions in a certain way, can't you?
|
Is there a "default" password for root? My friend has installed Mandrake on his laptop but is logged in as a local user... so he can't access etc/shadow to see passwords
|
dxdad, yes, you can use chmod to "set user or group ID on execution", as the man page puts it. With this set, you will run the application with permission(s) as the owner (chmod u+x) or group (chmod g+s) of the file. This is however, not recommended, for security reasons. At least when it comes to root-owned files.
Cruger, during the installation, Mandrake prompts for a root password. I don't know what Mandrake does if it isn't set. Maybe it's left empty; try su and see what happens - if the password is empty, then you should be let in at once. At least, I think so :) Otherwise, I think it's not that difficult to reset it. Unless I'm mistaken, give the option init=/bin/bash at the boot prompt and you should get a shell. Then use passwd to reset the password. |
All times are GMT -5. The time now is 10:12 PM. |