Skip to content

Instantly share code, notes, and snippets.

@AbdullahGhani1
Last active March 25, 2026 22:21
Show Gist options
  • Select an option

  • Save AbdullahGhani1/607b952ab75b47820bc3e763008301bb to your computer and use it in GitHub Desktop.

Select an option

Save AbdullahGhani1/607b952ab75b47820bc3e763008301bb to your computer and use it in GitHub Desktop.
Create a Linux User with non-interactive shell - KodeKloud

The System admin team of xFusionCorp Industries has installed a backup agent tool on all app servers. As per the tool's requirements they need to create a user with a non-interactive shell.Therefore, create a user named mark with a non-interactive shell in the app02 server

Click on ✔ and Do Task Again

Solution:-

SSh acording to Task

ssh tony@stapp01 ## AppServer 1 Pass= Ir0nM@n
### OR
ssh steve@stapp02 ## Appserver 2 Pass = Am3ric@
### OR
ssh banner@stapp03 ## AppServer 3 Pass = BigGr33n

Replace user Name Acording To Task

sudo adduser user -s /sbin/nologin
cut -d: -f1 /etc/passwd
@danielitogomez
Copy link
Copy Markdown

danielitogomez commented Jun 18, 2021

It's sudo adduser user -s /sbin/nologin instead that sudo adduser user -s /sbin/nologin/

@akbardotalam
Copy link
Copy Markdown

I tried creating the user with the above command but my task failed and the task not complete pops up.

@jaliagag
Copy link
Copy Markdown

jaliagag commented Jun 25, 2021

sudo adduser mark -s /sbin/false

or like I did: sudo adduser mark then sudo vi /etc/passwd and then changed the ending for the mark user from /sbin/bash to /sbin/false.

@suvra-roy
Copy link
Copy Markdown

Where did you get server credentials ?

@Jkudjo
Copy link
Copy Markdown

Jkudjo commented May 30, 2022

Server Name | IP | Hostname | User | Password

stapp01 | 172.16.238.10 | stapp01.stratos.xfusioncorp.com | tony | Ir0nM@n
stapp02 | 172.16.238.11 | stapp02.stratos.xfusioncorp.com | steve | Am3ric@
stapp03 | 172.16.238.12 | stapp03.stratos.xfusioncorp.com | banner | BigGr33n

@wila-diaz
Copy link
Copy Markdown

Server Name | IP | Hostname | User | Password

stapp01 | 172.16.238.10 | stapp01.stratos.xfusioncorp.com | tony | Ir0nM@n stapp02 | 172.16.238.11 | stapp02.stratos.xfusioncorp.com | steve | Am3ric@ stapp03 | 172.16.238.12 | stapp03.stratos.xfusioncorp.com | banner | BigGr33n

How did you find this information? @Jkudjo

@Jkudjo
Copy link
Copy Markdown

Jkudjo commented Jun 10, 2022 via email

@KalyaniSagane
Copy link
Copy Markdown

[sudo] password for banner:
how to find password?

@Nandha315
Copy link
Copy Markdown

the password and everything is in the wiki page in top left

@Sugarcothe
Copy link
Copy Markdown

that password does not work

@jf-lines
Copy link
Copy Markdown

My proposition was : useradd -Mr -s /usr/sbin/nologin LOGIN
RTFM (man useradd) ;)

@jezreelfasa
Copy link
Copy Markdown

This is how I created mine and it worked finally after several tries.
ssh into the server specified.
e.g. ssh tony@stapp01
enter the passwd for tony;
now create user with no interactive shell
sudo useradd --shell /bin/false john

check to see if the user created has no interactive shell, should look like this; /bin/false instead of /bin/bash

use this command to check:
cat /etc/passwd

@blankfil
Copy link
Copy Markdown

blankfil commented Jul 4, 2023

Having some background of Linux commands is of great help.
First ssh user@ with server name or ip address
input password for the particular user as provided
once you login: ls /home to check the existing users
sudo su to switch to root adduser

@Dconsultstech
Copy link
Copy Markdown

Yeah. I faced same issue too but i am able to resolve it using your guide. Thank you, it was very much helpful

@pratipc
Copy link
Copy Markdown

pratipc commented Mar 25, 2026

how to check for if i have successfully added the user ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment