Score:0

Change shell error

nl flag

Ubuntu 20.04

I am trying to change the shell for a user-backuppc:

brad@ubuntu:~$ su - backuppc /usr/bin/bash
Password: 
/usr/bin/bash: 1: Syntax error: "|" unexpected
brad@ubuntu:~$ whereis bash
bash: /usr/bin/bash /etc/bash.bashrc /usr/share/man/man1/bash.1.gz

Update: This was solved

-, -l, --login Start the shell as a login shell with an environment similar to a real login:

             o      clears all the environment variables except TERM and variables specified by --whitelist-environment

             o      initializes the environment variables HOME, SHELL, USER, LOGNAME, and PATH

             o      changes to the target user's home directory

             o      sets argv[0] of the shell to '-' in order to make the shell a login shell

butt:

brad@zika:~$ su -
Password: 
su: Authentication failure

What I am doing wrong here? Thanks folks!

terdon avatar
cn flag
What exactly are you trying to do? Did you mean to run `sudo -u backuppc chsh` or maybe `su backuppc chsh`? Are the first and second parts of your question related to each other? Please [edit] your question and give us some context. The `Authentication failure` is what you get when you give a wrong password. If that is not what is happening, we need more information.
Brad Thompson avatar
nl flag
no, is not wrong password, sudo works fine but su does not work
terdon avatar
cn flag
Please explain what you are doing. `su -` requires the password of the `root` user, while `sudo` will require the password of the `brad` user.
Score:3
cn flag

On Ubuntu, the root account is not activated. As a consequence, the command su - will not work. This command starts a login shell for the root user, which does not work. su - backuppc starts a login shell for user backuppc. This works if that user exists on the system.

To open an interactive prompt with root privileges, use sudo -i . Yet, for many administrator tasks, there is rarely a need to keep a terminal with root privileges open. Instead precede the commands that require root privileges with sudo.

To change the login shell of another user, for example user backuppc, you can use

sudo chsh backuppc -s <path-to-shell>
Brad Thompson avatar
nl flag
su - backuppc -s /bin/bash worked too. Activated or enabled? root on my box is enabled.
vanadium avatar
cn flag
Semantics: please enlighten me on the correct term and I will update it. On a default Ubuntu install, root account is disabled. su - therefore does not work. However, su - backuppc will. I will add a little note on that.
Brad Thompson avatar
nl flag
"disabled" is not politically correct maybe that is why you initially used the "activated" term :) :) :)
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.