How do I change my default shell on a AWS instance?
I want to change my shell from the default bash shell to zsh on my Amazon EC2 instances. How do I go about doing it? Thanks!
shell amazon-ec2
add a comment |
I want to change my shell from the default bash shell to zsh on my Amazon EC2 instances. How do I go about doing it? Thanks!
shell amazon-ec2
add a comment |
I want to change my shell from the default bash shell to zsh on my Amazon EC2 instances. How do I go about doing it? Thanks!
shell amazon-ec2
I want to change my shell from the default bash shell to zsh on my Amazon EC2 instances. How do I go about doing it? Thanks!
shell amazon-ec2
shell amazon-ec2
edited Aug 23 '15 at 0:34
Braiam
4,03631851
4,03631851
asked Jan 11 '11 at 11:31
Shripad KrishnaShripad Krishna
696277
696277
add a comment |
add a comment |
4 Answers
4
active
oldest
votes
Try using the chsh
command.
e.g.
chsh -s /bin/zsh
You can confirm the location of zsh by running whereis zsh
, or alternatively simply run
chsh -s $(which zsh)
If you want to change the shell for a user account other than the one you're logged into, you'll need to run it as root, so to change john's shell, do:
sudo chsh -s $(which zsh) john
Note that you'll need to log out and log back in for the change to go into effect. If you're using Gnome or some other window manager, you'll need to completely log out of that session as well—simply closing and opening your terminal is insufficient.
I did try that, but with the root user!! My AMI Image has ubuntu rather than root. Had to switch to ubuntu user to change the shell! Thanks for the hint :)
– Shripad Krishna
Jan 11 '11 at 11:45
3
@Paddy if you are root you can change it for another user by runningchsh -s /bin/zsh username
.
– John T
Jan 11 '11 at 11:47
Awesome :) Much easier. Thanks for that info too.
– Shripad Krishna
Jan 11 '11 at 11:48
3
@We are the World: You need to add /usr/local/bin/zsh as a new line to /etc/shells
– Nate Parsons
Jun 4 '13 at 17:54
4
I use a lightly different versionsudo chsh -s $(which zsh) $(whoami)
– SergioAraujo
Apr 30 '15 at 19:37
|
show 2 more comments
Open /etc/passwd:
sudo vi /etc/passwd
Find the line with your username:
username:x:1634231:100:Your Name:/home/username:/bin/bash
and replace bash with zsh:
username:x:1634231:100:Your Name:/home/username:/bin/zsh
Log out and log in back for the changes to take effect.
6
It's better to usechsh
, but if you're really going to edit/etc/passwd
by hand, at least use thevipw
command.
– Valmiky Arquissandas
Aug 14 '14 at 2:58
I don't have chsh on my machine. Also, for some weird reason my /etc/passwd file is regularly being overwritten by the default one. Do you know why this could be happening?
– Georgii Oleinikov
Aug 14 '14 at 16:44
Don't touch /etc/passwd. There are better ways to do this that do not require messing with the passwd tool!
– Andrew
Sep 12 '17 at 18:23
add a comment |
On Ubuntu, inside GNOME terminal, making changes via chsh won't have the expected effect...
To get over this problem, do this:
- Right click in terminal
- Profiles -> Profile Preferences
- Under "Title and Command" tab, tick "Run a custom command instead of my shell" and provide the path to zsh executable.
- Restart Terminal.
Peace.
P.S. Don't have 10 reputation to post images, so all texty instructions. :)
You have the rep you need now. :P
– pradyunsg
Mar 21 '16 at 8:43
add a comment |
I came here to just add more additional information.
If you have troubles when install zsh in Amazon Linux AMI by Amazon, like when you run:
sudo chsh $(which zsh) : // chsh command not found
Then you should install util-linux-user:
sudo yum install util-linux-user
(by default Amazon Linux AMI only has lchsh, but I can not figure how it work).
Then run the following command, it should work:
sudo chsh -s $(which zsh) $(whoami)
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
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
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f231735%2fhow-do-i-change-my-default-shell-on-a-aws-instance%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
Try using the chsh
command.
e.g.
chsh -s /bin/zsh
You can confirm the location of zsh by running whereis zsh
, or alternatively simply run
chsh -s $(which zsh)
If you want to change the shell for a user account other than the one you're logged into, you'll need to run it as root, so to change john's shell, do:
sudo chsh -s $(which zsh) john
Note that you'll need to log out and log back in for the change to go into effect. If you're using Gnome or some other window manager, you'll need to completely log out of that session as well—simply closing and opening your terminal is insufficient.
I did try that, but with the root user!! My AMI Image has ubuntu rather than root. Had to switch to ubuntu user to change the shell! Thanks for the hint :)
– Shripad Krishna
Jan 11 '11 at 11:45
3
@Paddy if you are root you can change it for another user by runningchsh -s /bin/zsh username
.
– John T
Jan 11 '11 at 11:47
Awesome :) Much easier. Thanks for that info too.
– Shripad Krishna
Jan 11 '11 at 11:48
3
@We are the World: You need to add /usr/local/bin/zsh as a new line to /etc/shells
– Nate Parsons
Jun 4 '13 at 17:54
4
I use a lightly different versionsudo chsh -s $(which zsh) $(whoami)
– SergioAraujo
Apr 30 '15 at 19:37
|
show 2 more comments
Try using the chsh
command.
e.g.
chsh -s /bin/zsh
You can confirm the location of zsh by running whereis zsh
, or alternatively simply run
chsh -s $(which zsh)
If you want to change the shell for a user account other than the one you're logged into, you'll need to run it as root, so to change john's shell, do:
sudo chsh -s $(which zsh) john
Note that you'll need to log out and log back in for the change to go into effect. If you're using Gnome or some other window manager, you'll need to completely log out of that session as well—simply closing and opening your terminal is insufficient.
I did try that, but with the root user!! My AMI Image has ubuntu rather than root. Had to switch to ubuntu user to change the shell! Thanks for the hint :)
– Shripad Krishna
Jan 11 '11 at 11:45
3
@Paddy if you are root you can change it for another user by runningchsh -s /bin/zsh username
.
– John T
Jan 11 '11 at 11:47
Awesome :) Much easier. Thanks for that info too.
– Shripad Krishna
Jan 11 '11 at 11:48
3
@We are the World: You need to add /usr/local/bin/zsh as a new line to /etc/shells
– Nate Parsons
Jun 4 '13 at 17:54
4
I use a lightly different versionsudo chsh -s $(which zsh) $(whoami)
– SergioAraujo
Apr 30 '15 at 19:37
|
show 2 more comments
Try using the chsh
command.
e.g.
chsh -s /bin/zsh
You can confirm the location of zsh by running whereis zsh
, or alternatively simply run
chsh -s $(which zsh)
If you want to change the shell for a user account other than the one you're logged into, you'll need to run it as root, so to change john's shell, do:
sudo chsh -s $(which zsh) john
Note that you'll need to log out and log back in for the change to go into effect. If you're using Gnome or some other window manager, you'll need to completely log out of that session as well—simply closing and opening your terminal is insufficient.
Try using the chsh
command.
e.g.
chsh -s /bin/zsh
You can confirm the location of zsh by running whereis zsh
, or alternatively simply run
chsh -s $(which zsh)
If you want to change the shell for a user account other than the one you're logged into, you'll need to run it as root, so to change john's shell, do:
sudo chsh -s $(which zsh) john
Note that you'll need to log out and log back in for the change to go into effect. If you're using Gnome or some other window manager, you'll need to completely log out of that session as well—simply closing and opening your terminal is insufficient.
edited Jan 25 '14 at 19:08
Heptite
14.8k54157
14.8k54157
answered Jan 11 '11 at 11:36
John TJohn T
142k20293329
142k20293329
I did try that, but with the root user!! My AMI Image has ubuntu rather than root. Had to switch to ubuntu user to change the shell! Thanks for the hint :)
– Shripad Krishna
Jan 11 '11 at 11:45
3
@Paddy if you are root you can change it for another user by runningchsh -s /bin/zsh username
.
– John T
Jan 11 '11 at 11:47
Awesome :) Much easier. Thanks for that info too.
– Shripad Krishna
Jan 11 '11 at 11:48
3
@We are the World: You need to add /usr/local/bin/zsh as a new line to /etc/shells
– Nate Parsons
Jun 4 '13 at 17:54
4
I use a lightly different versionsudo chsh -s $(which zsh) $(whoami)
– SergioAraujo
Apr 30 '15 at 19:37
|
show 2 more comments
I did try that, but with the root user!! My AMI Image has ubuntu rather than root. Had to switch to ubuntu user to change the shell! Thanks for the hint :)
– Shripad Krishna
Jan 11 '11 at 11:45
3
@Paddy if you are root you can change it for another user by runningchsh -s /bin/zsh username
.
– John T
Jan 11 '11 at 11:47
Awesome :) Much easier. Thanks for that info too.
– Shripad Krishna
Jan 11 '11 at 11:48
3
@We are the World: You need to add /usr/local/bin/zsh as a new line to /etc/shells
– Nate Parsons
Jun 4 '13 at 17:54
4
I use a lightly different versionsudo chsh -s $(which zsh) $(whoami)
– SergioAraujo
Apr 30 '15 at 19:37
I did try that, but with the root user!! My AMI Image has ubuntu rather than root. Had to switch to ubuntu user to change the shell! Thanks for the hint :)
– Shripad Krishna
Jan 11 '11 at 11:45
I did try that, but with the root user!! My AMI Image has ubuntu rather than root. Had to switch to ubuntu user to change the shell! Thanks for the hint :)
– Shripad Krishna
Jan 11 '11 at 11:45
3
3
@Paddy if you are root you can change it for another user by running
chsh -s /bin/zsh username
.– John T
Jan 11 '11 at 11:47
@Paddy if you are root you can change it for another user by running
chsh -s /bin/zsh username
.– John T
Jan 11 '11 at 11:47
Awesome :) Much easier. Thanks for that info too.
– Shripad Krishna
Jan 11 '11 at 11:48
Awesome :) Much easier. Thanks for that info too.
– Shripad Krishna
Jan 11 '11 at 11:48
3
3
@We are the World: You need to add /usr/local/bin/zsh as a new line to /etc/shells
– Nate Parsons
Jun 4 '13 at 17:54
@We are the World: You need to add /usr/local/bin/zsh as a new line to /etc/shells
– Nate Parsons
Jun 4 '13 at 17:54
4
4
I use a lightly different version
sudo chsh -s $(which zsh) $(whoami)
– SergioAraujo
Apr 30 '15 at 19:37
I use a lightly different version
sudo chsh -s $(which zsh) $(whoami)
– SergioAraujo
Apr 30 '15 at 19:37
|
show 2 more comments
Open /etc/passwd:
sudo vi /etc/passwd
Find the line with your username:
username:x:1634231:100:Your Name:/home/username:/bin/bash
and replace bash with zsh:
username:x:1634231:100:Your Name:/home/username:/bin/zsh
Log out and log in back for the changes to take effect.
6
It's better to usechsh
, but if you're really going to edit/etc/passwd
by hand, at least use thevipw
command.
– Valmiky Arquissandas
Aug 14 '14 at 2:58
I don't have chsh on my machine. Also, for some weird reason my /etc/passwd file is regularly being overwritten by the default one. Do you know why this could be happening?
– Georgii Oleinikov
Aug 14 '14 at 16:44
Don't touch /etc/passwd. There are better ways to do this that do not require messing with the passwd tool!
– Andrew
Sep 12 '17 at 18:23
add a comment |
Open /etc/passwd:
sudo vi /etc/passwd
Find the line with your username:
username:x:1634231:100:Your Name:/home/username:/bin/bash
and replace bash with zsh:
username:x:1634231:100:Your Name:/home/username:/bin/zsh
Log out and log in back for the changes to take effect.
6
It's better to usechsh
, but if you're really going to edit/etc/passwd
by hand, at least use thevipw
command.
– Valmiky Arquissandas
Aug 14 '14 at 2:58
I don't have chsh on my machine. Also, for some weird reason my /etc/passwd file is regularly being overwritten by the default one. Do you know why this could be happening?
– Georgii Oleinikov
Aug 14 '14 at 16:44
Don't touch /etc/passwd. There are better ways to do this that do not require messing with the passwd tool!
– Andrew
Sep 12 '17 at 18:23
add a comment |
Open /etc/passwd:
sudo vi /etc/passwd
Find the line with your username:
username:x:1634231:100:Your Name:/home/username:/bin/bash
and replace bash with zsh:
username:x:1634231:100:Your Name:/home/username:/bin/zsh
Log out and log in back for the changes to take effect.
Open /etc/passwd:
sudo vi /etc/passwd
Find the line with your username:
username:x:1634231:100:Your Name:/home/username:/bin/bash
and replace bash with zsh:
username:x:1634231:100:Your Name:/home/username:/bin/zsh
Log out and log in back for the changes to take effect.
answered Aug 13 '14 at 22:21
Georgii OleinikovGeorgii Oleinikov
29123
29123
6
It's better to usechsh
, but if you're really going to edit/etc/passwd
by hand, at least use thevipw
command.
– Valmiky Arquissandas
Aug 14 '14 at 2:58
I don't have chsh on my machine. Also, for some weird reason my /etc/passwd file is regularly being overwritten by the default one. Do you know why this could be happening?
– Georgii Oleinikov
Aug 14 '14 at 16:44
Don't touch /etc/passwd. There are better ways to do this that do not require messing with the passwd tool!
– Andrew
Sep 12 '17 at 18:23
add a comment |
6
It's better to usechsh
, but if you're really going to edit/etc/passwd
by hand, at least use thevipw
command.
– Valmiky Arquissandas
Aug 14 '14 at 2:58
I don't have chsh on my machine. Also, for some weird reason my /etc/passwd file is regularly being overwritten by the default one. Do you know why this could be happening?
– Georgii Oleinikov
Aug 14 '14 at 16:44
Don't touch /etc/passwd. There are better ways to do this that do not require messing with the passwd tool!
– Andrew
Sep 12 '17 at 18:23
6
6
It's better to use
chsh
, but if you're really going to edit /etc/passwd
by hand, at least use the vipw
command.– Valmiky Arquissandas
Aug 14 '14 at 2:58
It's better to use
chsh
, but if you're really going to edit /etc/passwd
by hand, at least use the vipw
command.– Valmiky Arquissandas
Aug 14 '14 at 2:58
I don't have chsh on my machine. Also, for some weird reason my /etc/passwd file is regularly being overwritten by the default one. Do you know why this could be happening?
– Georgii Oleinikov
Aug 14 '14 at 16:44
I don't have chsh on my machine. Also, for some weird reason my /etc/passwd file is regularly being overwritten by the default one. Do you know why this could be happening?
– Georgii Oleinikov
Aug 14 '14 at 16:44
Don't touch /etc/passwd. There are better ways to do this that do not require messing with the passwd tool!
– Andrew
Sep 12 '17 at 18:23
Don't touch /etc/passwd. There are better ways to do this that do not require messing with the passwd tool!
– Andrew
Sep 12 '17 at 18:23
add a comment |
On Ubuntu, inside GNOME terminal, making changes via chsh won't have the expected effect...
To get over this problem, do this:
- Right click in terminal
- Profiles -> Profile Preferences
- Under "Title and Command" tab, tick "Run a custom command instead of my shell" and provide the path to zsh executable.
- Restart Terminal.
Peace.
P.S. Don't have 10 reputation to post images, so all texty instructions. :)
You have the rep you need now. :P
– pradyunsg
Mar 21 '16 at 8:43
add a comment |
On Ubuntu, inside GNOME terminal, making changes via chsh won't have the expected effect...
To get over this problem, do this:
- Right click in terminal
- Profiles -> Profile Preferences
- Under "Title and Command" tab, tick "Run a custom command instead of my shell" and provide the path to zsh executable.
- Restart Terminal.
Peace.
P.S. Don't have 10 reputation to post images, so all texty instructions. :)
You have the rep you need now. :P
– pradyunsg
Mar 21 '16 at 8:43
add a comment |
On Ubuntu, inside GNOME terminal, making changes via chsh won't have the expected effect...
To get over this problem, do this:
- Right click in terminal
- Profiles -> Profile Preferences
- Under "Title and Command" tab, tick "Run a custom command instead of my shell" and provide the path to zsh executable.
- Restart Terminal.
Peace.
P.S. Don't have 10 reputation to post images, so all texty instructions. :)
On Ubuntu, inside GNOME terminal, making changes via chsh won't have the expected effect...
To get over this problem, do this:
- Right click in terminal
- Profiles -> Profile Preferences
- Under "Title and Command" tab, tick "Run a custom command instead of my shell" and provide the path to zsh executable.
- Restart Terminal.
Peace.
P.S. Don't have 10 reputation to post images, so all texty instructions. :)
answered Aug 10 '15 at 3:46
BenBen
411
411
You have the rep you need now. :P
– pradyunsg
Mar 21 '16 at 8:43
add a comment |
You have the rep you need now. :P
– pradyunsg
Mar 21 '16 at 8:43
You have the rep you need now. :P
– pradyunsg
Mar 21 '16 at 8:43
You have the rep you need now. :P
– pradyunsg
Mar 21 '16 at 8:43
add a comment |
I came here to just add more additional information.
If you have troubles when install zsh in Amazon Linux AMI by Amazon, like when you run:
sudo chsh $(which zsh) : // chsh command not found
Then you should install util-linux-user:
sudo yum install util-linux-user
(by default Amazon Linux AMI only has lchsh, but I can not figure how it work).
Then run the following command, it should work:
sudo chsh -s $(which zsh) $(whoami)
add a comment |
I came here to just add more additional information.
If you have troubles when install zsh in Amazon Linux AMI by Amazon, like when you run:
sudo chsh $(which zsh) : // chsh command not found
Then you should install util-linux-user:
sudo yum install util-linux-user
(by default Amazon Linux AMI only has lchsh, but I can not figure how it work).
Then run the following command, it should work:
sudo chsh -s $(which zsh) $(whoami)
add a comment |
I came here to just add more additional information.
If you have troubles when install zsh in Amazon Linux AMI by Amazon, like when you run:
sudo chsh $(which zsh) : // chsh command not found
Then you should install util-linux-user:
sudo yum install util-linux-user
(by default Amazon Linux AMI only has lchsh, but I can not figure how it work).
Then run the following command, it should work:
sudo chsh -s $(which zsh) $(whoami)
I came here to just add more additional information.
If you have troubles when install zsh in Amazon Linux AMI by Amazon, like when you run:
sudo chsh $(which zsh) : // chsh command not found
Then you should install util-linux-user:
sudo yum install util-linux-user
(by default Amazon Linux AMI only has lchsh, but I can not figure how it work).
Then run the following command, it should work:
sudo chsh -s $(which zsh) $(whoami)
answered Dec 31 '18 at 14:30
chau giangchau giang
211
211
add a comment |
add a comment |
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
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
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f231735%2fhow-do-i-change-my-default-shell-on-a-aws-instance%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
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
Required, but never shown
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
Required, but never shown
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
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown