PDA

Bekijk de volledige versie : login as standard user and su



mistraller
26-02-2007, 15:36
I have some troubles with login as standard user and su as root:"

First problem: After logging in as standard user with bash as login shell:

[I have no name!@router ~]

Login in with standard shell gives me also [@router userhome]

So I don't get my username.

After logging in I want to su as root (I renamed root account)

su rootuser gives:
su: This applet requires root priviledges!

How can I solve these 2 problems?

Fazoletti
28-02-2007, 17:58
Hello,

you can change your prompt by changing your .bashrc.
If you add the following text your prompt will appear in the usual way

PS1='[\u@\h \W]$ '

you can login via 'su' if you add the suid bit to 'adduser' which is a multicall binary containing this command. Before you have to install adduser with
'ipkg adduser'.

chmod u+s /opt/bin/adduser

I don't know if it's safe!!

Sorry, i must correct!
The file to customize the prompt is '.bash_profile' not '.bashrc'
here's another example for a nice prompt:

COLOR1="\[\033[0;36m\]"
COLOR2="\[\033[0;32m\]"
COLOR3="\[\033[1;33m\]"
COLOR4="\[\033[1;37m\]"

PS1="$COLOR2($COLOR3\u@\h$COLOR2:$COLOR1\$PWD$COLOR1\\$ $COLOR4"

http://home.arcor.de/wfe/bashprompt.png

mistraller
01-03-2007, 21:56
Hello,

you can change your prompt by changing your .bashrc.
If you add the following text your prompt will appear in the usual way

PS1='[\u@\h \W]$ '

you can login via 'su' if you add the suid bit to 'adduser' which is a multicall binary containing this command. Before you have to install adduser with
'ipkg adduser'.

chmod u+s /opt/bin/adduser

I don't know if it's safe!!

Sorry, i must correct!
The file to customize the prompt is '.bash_profile' not '.bashrc'
here's another example for a nice prompt:

COLOR1="\[\033[0;36m\]"
COLOR2="\[\033[0;32m\]"
COLOR3="\[\033[1;33m\]"
COLOR4="\[\033[1;37m\]"

PS1="$COLOR2($COLOR3\u@\h$COLOR2:$COLOR1\$PWD$COLOR1\\$ $COLOR4"

http://home.arcor.de/wfe/bashprompt.png

And where should I put the .bash_profile? I put it in the users' homedir, but I still got "I have no name!".


Shouldn't I chmod the su command instead of adduser?

Fazoletti
02-03-2007, 12:09
The 'su' is only a link to the su applet of adduser or to busybox.
If you chmod to su you set the suid bit to one of them.

Yes, in the home directory!
Are you sure you've installed bash?
Have you set the login shell in passwd to bash?

mistraller
02-03-2007, 18:45
The 'su' is only a link to the su applet of adduser or to busybox.
If you chmod to su you set the suid bit to one of them.

Yes, in the home directory!
Are you sure you've installed bash?
Have you set the login shell in passwd to bash?

Of course, otherwise my homedir wouldn't be shown as ~.
And I DO have a .bash_history in my homedir.

The suid command on adduser did the trick. The username problem was caused by permissions on "passwd". It was only rw for root. chmod 644 passwd was enough to get [username@router ~]