# Hola , Linux 👋👋| User account with no login access.

# **What is Hola, Linux 👋 ?**

Hola, Linux 👋 is a project that you can depend on it as a starter code for your brain 🧠 to rebuild Linux concepts.

**Why this is possible?**

* There's a user that you need to disable his/her account and restrict from using a command-line.
    
* Service Users.
    

First of all, lets grep information about all nologin users. if you didn't add users before to the nologin shell, the all users displayed are the service users.

```apache
mosalah@factory~$ grep nologin /etc/passwd
```

* Add new user and attach that user to the nologin shell.
    

### **Add new user "hashnoder" to nologin shell.**

```apache
mosalah@factory~$ sudo useradd -s /sbin/nologin hashnoder
```

in the previous command i added new user, ***hashnoder*** and attached that user to nologin shell and now he can't start a command-line session.

If you want to switch an existing login user to restrict him/her from accessing the command-line utilities.

```apache
mosalah@factory~$ sudo usermod -s /sbin/nologin ex_hashnoder
```

in the previous command i modified an existing user, ***ex-hashnoder*** and attached that user to nologin shell, now he can't start a command-line session and he is restricted.

\* You can display the ***hashnoder*** user and make sure he is attached to the nologin shell.

```apache
mosalah@factory~$ grep hashnoder /etc/passwd
```

you should see this entry.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1676846330718/1d1bd088-cfd2-4f71-b4ae-7468e204fce7.png align="center")

### **Verfication Time.**

Let's try to switch to the nologin user ***hashnoder*** through the CLI.

```plaintext
mosalah@factory~$ su - hashnoder
```

You should see a message

***"This account is currently not available."***

### Customize nologin shell message.

* open the ***/etc/nologin.txt*** using your favorite editor.
    

```plaintext
mosalah@factory~$vi /etc/nologin.txt
```

\-&gt; Write your preferred message

Try again to switch to ***hashnoder*** user.

```apache
mosalah@factory~$ su - hashnoder
```

Your preferred message is shown instead of the default message.

To go back to your default (old) message, remove the */etc/nologin.txt file*

```apache
 mosalah@factory~$ sudo rm /etc/nologin.txt
```

# **Conclusion.**

* We created a new user and restrict that user from starting command-line sessions and he/she is no longer able to write command or login to the system.
    
* We modified an exiting user from login shell to nologin shell.
    
* We customized the default message that is displayed to the nologin user.
