Search code examples
bashsu

How to escape the `su -arch`?


I assign an account name arch.

useradd -m -G users  arch
passwd arch

Now su into arch with command su -arch.

enter image description here

How to su into the account name arch with some kind of escape method?


Solution

  • I think the confusion is because you could login as root using

    su - # There are no options in this case and the default login is root
    

    But you're not supposed to do

    su -arch #Anything the follows is an option
    

    Since a is not a valid option you got an error

    The right way could be anyone among the below

    su arch 
    su - arch # mind the space
    su -- arch # The -- marks the end of options, gives way for non-options arguments