Results 1 to 5 of 5

Thread: login as standard user and su

  1. #1
    Join Date
    Apr 2006
    Location
    Heesch, Netherlands
    Posts
    118

    login as standard user and su

    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?

  2. #2
    Join Date
    Aug 2006
    Location
    Hangover
    Posts
    57
    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$COLO R1\\$ $COLOR4"

    Last edited by Fazoletti; 01-03-2007 at 20:23.

  3. #3
    Join Date
    Apr 2006
    Location
    Heesch, Netherlands
    Posts
    118
    Quote Originally Posted by Fazoletti View Post
    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$COLO R1\\$ $COLOR4"

    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?
    Last edited by mistraller; 01-03-2007 at 22:59.

  4. #4
    Join Date
    Aug 2006
    Location
    Hangover
    Posts
    57
    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?

  5. #5
    Join Date
    Apr 2006
    Location
    Heesch, Netherlands
    Posts
    118
    Quote Originally Posted by Fazoletti View Post
    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 ~]
    Last edited by mistraller; 02-03-2007 at 19:59.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •