How do I change (permanently) default shell after login on specific TTYn in Linux?
Clash Royale CLAN TAG#URR8PPP
up vote
3
down vote
favorite
I know that the chsh
command is used to switch login shell for a user between installed shells, but it works regardless of where login comes from (tty1, tty2, ssh, ...). What I'd like to achieve is to have e.g. csh
on logins from tty7 and e.g. bash
on all other login sources.
Is this doable at all?
linux shell scripting login tty
add a comment |Â
up vote
3
down vote
favorite
I know that the chsh
command is used to switch login shell for a user between installed shells, but it works regardless of where login comes from (tty1, tty2, ssh, ...). What I'd like to achieve is to have e.g. csh
on logins from tty7 and e.g. bash
on all other login sources.
Is this doable at all?
linux shell scripting login tty
add a comment |Â
up vote
3
down vote
favorite
up vote
3
down vote
favorite
I know that the chsh
command is used to switch login shell for a user between installed shells, but it works regardless of where login comes from (tty1, tty2, ssh, ...). What I'd like to achieve is to have e.g. csh
on logins from tty7 and e.g. bash
on all other login sources.
Is this doable at all?
linux shell scripting login tty
I know that the chsh
command is used to switch login shell for a user between installed shells, but it works regardless of where login comes from (tty1, tty2, ssh, ...). What I'd like to achieve is to have e.g. csh
on logins from tty7 and e.g. bash
on all other login sources.
Is this doable at all?
linux shell scripting login tty
edited Feb 8 at 18:18
Kusalananda
103k13202318
103k13202318
asked Feb 8 at 17:44
Anonymous
1335
1335
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
8
down vote
accepted
No and yes.
No, the login shell is tied to the user, not to the TTY where the user logs in. A user can only have one specific login shell.
Yes, the user may, in the login shell's initialization files, start any other program or utility depending on any condition.
For example, a user with bash
as their current login shell could add something like the following to their .bash_profile
file to run csh
when logging in on virtual terminal 7:
case $(tty) in
*/tty7) exec csh -l ;;
esac
exec csh -l
would replace the current shell with csh
, started as a login shell.
Sounds reasonable, going to check it out - thx!
â Anonymous
Feb 8 at 18:03
1
omg it worked! btw, names are /dev/tty1 ... tty63 so I've changed pattern after 'in' to *tty7. SO MUCH THANK YOU!
â Anonymous
Feb 8 at 18:11
The pseudo-terminals used by SSH and terminal emulators are/dev/pts/0
..., the fixed virtual and serial terminals aretty1
... andttyS0
... The numbers of thepts/N
ones don't really mean anything, they're just allocated so that you get the next free one.
â ilkkachu
Feb 8 at 18:32
@ilkkachu Thanks for the info and for the edit!
â Kusalananda
Feb 8 at 18:43
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
8
down vote
accepted
No and yes.
No, the login shell is tied to the user, not to the TTY where the user logs in. A user can only have one specific login shell.
Yes, the user may, in the login shell's initialization files, start any other program or utility depending on any condition.
For example, a user with bash
as their current login shell could add something like the following to their .bash_profile
file to run csh
when logging in on virtual terminal 7:
case $(tty) in
*/tty7) exec csh -l ;;
esac
exec csh -l
would replace the current shell with csh
, started as a login shell.
Sounds reasonable, going to check it out - thx!
â Anonymous
Feb 8 at 18:03
1
omg it worked! btw, names are /dev/tty1 ... tty63 so I've changed pattern after 'in' to *tty7. SO MUCH THANK YOU!
â Anonymous
Feb 8 at 18:11
The pseudo-terminals used by SSH and terminal emulators are/dev/pts/0
..., the fixed virtual and serial terminals aretty1
... andttyS0
... The numbers of thepts/N
ones don't really mean anything, they're just allocated so that you get the next free one.
â ilkkachu
Feb 8 at 18:32
@ilkkachu Thanks for the info and for the edit!
â Kusalananda
Feb 8 at 18:43
add a comment |Â
up vote
8
down vote
accepted
No and yes.
No, the login shell is tied to the user, not to the TTY where the user logs in. A user can only have one specific login shell.
Yes, the user may, in the login shell's initialization files, start any other program or utility depending on any condition.
For example, a user with bash
as their current login shell could add something like the following to their .bash_profile
file to run csh
when logging in on virtual terminal 7:
case $(tty) in
*/tty7) exec csh -l ;;
esac
exec csh -l
would replace the current shell with csh
, started as a login shell.
Sounds reasonable, going to check it out - thx!
â Anonymous
Feb 8 at 18:03
1
omg it worked! btw, names are /dev/tty1 ... tty63 so I've changed pattern after 'in' to *tty7. SO MUCH THANK YOU!
â Anonymous
Feb 8 at 18:11
The pseudo-terminals used by SSH and terminal emulators are/dev/pts/0
..., the fixed virtual and serial terminals aretty1
... andttyS0
... The numbers of thepts/N
ones don't really mean anything, they're just allocated so that you get the next free one.
â ilkkachu
Feb 8 at 18:32
@ilkkachu Thanks for the info and for the edit!
â Kusalananda
Feb 8 at 18:43
add a comment |Â
up vote
8
down vote
accepted
up vote
8
down vote
accepted
No and yes.
No, the login shell is tied to the user, not to the TTY where the user logs in. A user can only have one specific login shell.
Yes, the user may, in the login shell's initialization files, start any other program or utility depending on any condition.
For example, a user with bash
as their current login shell could add something like the following to their .bash_profile
file to run csh
when logging in on virtual terminal 7:
case $(tty) in
*/tty7) exec csh -l ;;
esac
exec csh -l
would replace the current shell with csh
, started as a login shell.
No and yes.
No, the login shell is tied to the user, not to the TTY where the user logs in. A user can only have one specific login shell.
Yes, the user may, in the login shell's initialization files, start any other program or utility depending on any condition.
For example, a user with bash
as their current login shell could add something like the following to their .bash_profile
file to run csh
when logging in on virtual terminal 7:
case $(tty) in
*/tty7) exec csh -l ;;
esac
exec csh -l
would replace the current shell with csh
, started as a login shell.
edited Feb 8 at 18:42
answered Feb 8 at 17:58
Kusalananda
103k13202318
103k13202318
Sounds reasonable, going to check it out - thx!
â Anonymous
Feb 8 at 18:03
1
omg it worked! btw, names are /dev/tty1 ... tty63 so I've changed pattern after 'in' to *tty7. SO MUCH THANK YOU!
â Anonymous
Feb 8 at 18:11
The pseudo-terminals used by SSH and terminal emulators are/dev/pts/0
..., the fixed virtual and serial terminals aretty1
... andttyS0
... The numbers of thepts/N
ones don't really mean anything, they're just allocated so that you get the next free one.
â ilkkachu
Feb 8 at 18:32
@ilkkachu Thanks for the info and for the edit!
â Kusalananda
Feb 8 at 18:43
add a comment |Â
Sounds reasonable, going to check it out - thx!
â Anonymous
Feb 8 at 18:03
1
omg it worked! btw, names are /dev/tty1 ... tty63 so I've changed pattern after 'in' to *tty7. SO MUCH THANK YOU!
â Anonymous
Feb 8 at 18:11
The pseudo-terminals used by SSH and terminal emulators are/dev/pts/0
..., the fixed virtual and serial terminals aretty1
... andttyS0
... The numbers of thepts/N
ones don't really mean anything, they're just allocated so that you get the next free one.
â ilkkachu
Feb 8 at 18:32
@ilkkachu Thanks for the info and for the edit!
â Kusalananda
Feb 8 at 18:43
Sounds reasonable, going to check it out - thx!
â Anonymous
Feb 8 at 18:03
Sounds reasonable, going to check it out - thx!
â Anonymous
Feb 8 at 18:03
1
1
omg it worked! btw, names are /dev/tty1 ... tty63 so I've changed pattern after 'in' to *tty7. SO MUCH THANK YOU!
â Anonymous
Feb 8 at 18:11
omg it worked! btw, names are /dev/tty1 ... tty63 so I've changed pattern after 'in' to *tty7. SO MUCH THANK YOU!
â Anonymous
Feb 8 at 18:11
The pseudo-terminals used by SSH and terminal emulators are
/dev/pts/0
..., the fixed virtual and serial terminals are tty1
... and ttyS0
... The numbers of the pts/N
ones don't really mean anything, they're just allocated so that you get the next free one.â ilkkachu
Feb 8 at 18:32
The pseudo-terminals used by SSH and terminal emulators are
/dev/pts/0
..., the fixed virtual and serial terminals are tty1
... and ttyS0
... The numbers of the pts/N
ones don't really mean anything, they're just allocated so that you get the next free one.â ilkkachu
Feb 8 at 18:32
@ilkkachu Thanks for the info and for the edit!
â Kusalananda
Feb 8 at 18:43
@ilkkachu Thanks for the info and for the edit!
â Kusalananda
Feb 8 at 18:43
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f422871%2fhow-do-i-change-permanently-default-shell-after-login-on-specific-ttyn-in-linu%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password