Skip to main content
Addressed the specific problem uncovered after edit and comment by OP's authors.
Source Link
Cbhihe
  • 2.9k
  • 4
  • 24
  • 33

If your user had a login shell, you would need to type in your cmd as: su --shell=/bin/bash locked or sudo -u locked /bin/bash, provided Bash is available and listed in /etc/shellprovided the default shell specified for the target user is listed in /etc/shell.
(Note that there is an equal sign after the long option --shell.)

However:

  1. the point of having a user with no login shell is precisely that that user cannot login in any way, be it directly at session start or via another user account. Oddly that is exactly what you are trying to achieve.

  2. to be able to access that user (provided it has a login shell, by switching to its profile as shown above, you will generally need sudo privileges, or at least be able to use the su cmd...

Can you tell us, what you are trying to achieve ? It seems you are confused about no-login accounts, so expounding your ultimate objective may be helpful in advising you as to how you can do what you want to achieve.

If your user had a login shell, you would need to type in your cmd as: su --shell=/bin/bash locked or sudo -u locked /bin/bash, provided Bash is available and listed in /etc/shell.
(Note that there is an equal sign after the long option --shell.)

However:

  1. the point of having a user with no login shell is precisely that that user cannot login in any way, be it directly at session start or via another user account. Oddly that is exactly what you are trying to achieve.

  2. to be able to access that user (provided it has a login shell, by switching to its profile as shown above, you will generally need sudo privileges, or at least be able to use the su cmd...

Can you tell us, what you are trying to achieve ? It seems you are confused about no-login accounts, so expounding your ultimate objective may be helpful in advising you as to how you can do what you want to achieve.

If your user had a login shell, you would need to type in your cmd as: su --shell=/bin/bash locked or sudo -u locked /bin/bash, provided the default shell specified for the target user is listed in /etc/shell.
(Note that there is an equal sign after the long option --shell.)

However:

  1. the point of having a user with no login shell is precisely that that user cannot login in any way, be it directly at session start or via another user account. Oddly that is exactly what you are trying to achieve.

  2. to be able to access that user (provided it has a login shell, by switching to its profile as shown above, you will generally need sudo privileges, or at least be able to use the su cmd...

Completed answer given OP's additional info.
Source Link
Cbhihe
  • 2.9k
  • 4
  • 24
  • 33

YouIf your user had a login shell, you would need to type in your cmd as: su --shell=/bin/bash locked or sudo -u locked /bin/bash, provided Bash is available naturally. Note that there is an equal sign after the long optionand listed in --/etc/shell.
(Note that there is an equal sign after the long option --shell.)

Check the fileHowever:

  1. the point of having a user with no login shell is precisely that that user cannot login in any way, be it directly at session start or via another user account. Oddly that is exactly what you are trying to achieve.

  2. to be able to access that user (provided it has a login shell, by switching to its profile as shown above, you will generally need sudo privileges, or at least be able to use the su cmd...

Can you tell us, /etc/shellswhat you are trying to see shells availableachieve ? It seems you are confused about no-login accounts, so expounding your ultimate objective may be helpful in advising you as to how you) can do what you want to achieve.

You need to type in your cmd as: su --shell=/bin/bash locked, provided Bash is available naturally. Note that there is an equal sign after the long option --shell.

Check the file /etc/shells to see shells available to you).

If your user had a login shell, you would need to type in your cmd as: su --shell=/bin/bash locked or sudo -u locked /bin/bash, provided Bash is available and listed in /etc/shell.
(Note that there is an equal sign after the long option --shell.)

However:

  1. the point of having a user with no login shell is precisely that that user cannot login in any way, be it directly at session start or via another user account. Oddly that is exactly what you are trying to achieve.

  2. to be able to access that user (provided it has a login shell, by switching to its profile as shown above, you will generally need sudo privileges, or at least be able to use the su cmd...

Can you tell us, what you are trying to achieve ? It seems you are confused about no-login accounts, so expounding your ultimate objective may be helpful in advising you as to how you can do what you want to achieve.

Source Link
Cbhihe
  • 2.9k
  • 4
  • 24
  • 33

You need to type in your cmd as: su --shell=/bin/bash locked, provided Bash is available naturally. Note that there is an equal sign after the long option --shell.

Check the file /etc/shells to see shells available to you).