Linux - SecurityThis forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Neither I can execute with sudo nor the /sbin directory is writable for me.
I just wonder, since su --shell allow me to specifiy a shell to use instead of the shell specified in /etc/passwd, is it possible for me to tell "su" to ignore the shell specified in /etc/passwd?
DESCRIPTION
su is used to become another user during a login session. Invoked
without a username, su defaults to becoming the super user. The
optional argument - may be used to provide an environment similiar to
what the user would expect had the user logged in directly.
The user will be prompted for a password, if appropriate. Invalid
passwords will produce an error message. All attempts, both valid and
invalid, are logged to detect abuses of the system.
An optional command can be executed. This is done by the shell speci-
fied in /etc/passwd for the target user unless the -s or -m options are
used. Any arguments supplied after the username will be passed to the
invoked shell (shell must support the -c command line option in order
for a command to be passed to it).
Unless the -m or -p options are used, the current environment is passed
to the new shell with alterations. The value of $PATH is reset to
/bin:/usr/bin for normal users, or /sbin:/bin:/usr/sbin:/usr/bin for
the super user. This may be changed with the ENV_PATH and ENV_SUPATH
definitions in /etc/login.defs. $IFS, if is set, is reset to contain
space, tab, and newline. $USER is set to the name of the target user,
$HOME is set to the home directory of the target user, and $SHELL is
set to the shell of the target user. When using the -m or -p options,
the user's environment is not changed.
A subsystem login is indicated by the presense of a "*" as the first
character of the login shell. The given home directory will be used as
the root of a new filesystem which the user is actually logged into.
OPTIONS
- make this a login shell
-c, --commmand=<command>
pass command to the invoked shell using its -c option
-m, -p, --preserve-environment
do not reset environment variables, and keep the same shell
-s, --shell=<shell>
use shell instead of the default in /etc/passwd
NOTES
The -m, -p and -s options are restricted by the target user's shell
being listed in /etc/shells. If it's not listed, then it's assumed to
be a restricted account, a normal su is performed, and those options
are ignored silently.
A subsystem login is indicated by the presense of a "*" as the first
character of the login shell. The given home directory will be used as
the root of a new filesystem which the user is actually logged into.
Much of the behavior of this command can be altered via its pam config-
uration - see pam(7)
CAVEATS
This version of su has many compilation options, only some of which may
be in use at any particular site.
FILES
/etc/passwd - user account information
/etc/shadow - encrypted passwords and age information
/etc/shells - valid user shells
$HOME/.profile - initialization script for default shell
reboot and in the grup boot prompt type
linux init=/bin/bash
that will take you into the single user raw mode.
edit /etc/passwd file to refflect /bin/bash as the login shell and reboot
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.