MASIGNCLEAN101

How to Change Users Login Gshell in Linuix Updated FREE

How to Change Users Login Gshell in Linuix

In this article, we will depict how to alter a user'south shell in Linux. The shell is a program that accepts and interprets commands; at that place are several shells such as bash, sh, ksh, zsh, fish and many other lesser known shells available on Linux.

Bash (/bin/fustigate) is a popular shell on most if not all Linux systems, and it's normally the default shell for user accounts.

Read Besides: five About Frequently Used Open Source Shells for Linux

At that place are several reasons for changing a user's shell in Linux including the following:

  1. To block or disable normal user logins in Linux using a nologin shell.
  2. Use a shell wrapper script or program to login user commands before they are sent to a beat for execution. Hither, you specify the shell wrapper as a user's login shell.
  3. To come across a user's demands (wants to utilise a specific crush), especially those with administrative rights.

When creating user accounts with the useradd or adduser utilities, the --trounce flag can be used to specify the name of a user'southward login shell other than that specified in the corresponding configuration files.

A login shell tin can exist accessed from a text based interface or via a SSH from remote Linux motorcar. However, if yous login via a graphical user interface (GUI), you can access the beat from a concluding emulators similar xterm, konsole and many more than.

Let'due south starting time listing all available shells on your Linux arrangement, type.

          # cat /etc/shells          /bin/sh /bin/fustigate /sbin/nologin /bin/tcsh /bin/csh /bin/dash        

Before y'all proceed any further, note that:

  • A user can change their own crush to whatever thing: which, however must be listed in the /etc/shells file.
  • Just root can run a crush non listed in /etc/shells file.
  • If an account has a restricted login shell, and so only root can modify that user's shell.

At present permit'south hash out iii different ways to change Linux user shell.

1. usermod Utility

usermod is a utility for modifying a user's account details, stored in the /etc/passwd file and the -s or --crush pick is used to change the user's login shell.

In this example, nosotros'll first check user tecmint'southward account information to view his default login shell and so change its login vanquish from /bin/sh to /bin/bash as follows.

# grep tecmint /etc/passwd          # usermod --shell /bin/bash tecmint          # grep tecmint /etc/passwd        
Change User Shell using Usermod
Change User Beat using Usermod

2. chsh Utility

chsh is a command line utility for changing a login shell with the -south or –shell choice similar this.

# grep tecmint /etc/passwd          # chsh --shell /bin/sh tecmint          # grep tecmint /etc/passwd        
Change User Shell Using chsh
Change User Shell Using chsh

The 2 methods above all change the beat specified in /etc/passwd file which you can edit manually as in the third method below.

three. Modify User Shell in /etc/passwd File

In this method, only open the /etc/passwd file using any of your favorite control line text editors and change a specific users shell.

# half-dozen /etc/passwd        
Change User Shell in Passwd File
Change User Vanquish in Passwd File

When your done editing, save and close the file.

Do non forget to read these related topics:

  1. Agreement Beat out Initialization Files and User Profiles in Linux
  2. Understand Linux Beat out and Bones Shell Scripting Tips – Role I
  3. How To Write and Use Custom Shell Functions and Libraries
  4. Understanding Unlike Classifications of Shell Commands and Their Usage

In this article, we described various ways of changing a user's trounce in Linux. To share any thoughts with us, use the comment section below.

If You lot Appreciate What We Do Hither On TecMint, Yous Should Consider:

TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published manufactures bachelor FREELY to all.

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Support Us

We are thankful for your never catastrophe support.

How to Change Users Login Gshell in Linuix

DOWNLOAD HERE

Source: https://www.tecmint.com/change-a-users-default-shell-in-linux/

Posted by: 12newsonlineaui.blogspot.com

Share This :