Getting an admin shell "sudo su"

I may be missing something here, and I’m not an ace on debian. Typing

sudo su

does not give me an administrator shell. I get a message telling me that my account has expired and to contact my administrator. Am I usung the correct command?

1 Like

You can use this command:

sudo -i

or this one

sudo bash
3 Likes

sudo -s

2 Likes

Now I got curious about the difference between -i and -s.

man sudo says:

[...]
    -i, --login
       Run the shell specified by the target user's password database entry as a login shell.
[...]
    -s, --shell
       Run the shell specified by the SHELL environment variable if it is set or the shell specified by the invoking user's password database entry.
3 Likes

Thanks. I suspected a user error. I’ll check out later

1 Like

After evaluating your need to be running commands directly as the root user rather than using sudo, the following commands may be used to adjust the expiration date of the root user and therefore enable direct shell access:

$ man chage
NAME
       chage - change user password expiry information
[...]
       -E, --expiredate EXPIRE_DATE
           Set the date or number of days since January 1, 1970 on which the
           user's account will no longer be accessible. The date may also be
           expressed in the format YYYY-MM-DD (or the format more commonly
           used in your area). A user whose account is locked must contact the
           system administrator before being able to use the system again.

           For example the following can be used to set an account to expire
           in 180 days:

                        chage -E $(date -d +180days +%Y-%m-%d)

           Passing the number -1 as the EXPIRE_DATE will remove an account
           expiration date.

[...]
       -l, --list
           Show account aging information.

Examples:

  • sudo chage -l root
  • sudo chage -E never root
  • sudo chage -E 2025-12-31 root
6 Likes