Linux commands for creating users

Source: Internet
Author: User

Linux commands for creating users
Useradd-g test-d/home/test1-s/etc/bash-m test1
Note:-G belongs to group- D home Directory
Delete User command
Userdel-r test1
Create password command
passwd

See which command the user group is under Linux!

View/etc/group File

With cat/etc/passwd |cut-f 1-d:

How Linux prohibits users from logging on remotely:
1. When adding a new user, specify that the user cannot log in remotely

Useradd-s/sbin/nologin ZGSJ//This is the creation of a ZGSJ user who cannot log in remotely

passwd ZGSJ//modify ZGSJ user password

1, prohibit individual users to log in. For example, prohibit ZGSJ users from logging in.

Passwd-l ZGSJ//Lock ZSGJ User, disable ZGSJ user login

This means locking the ZGSJ user so that the user cannot log on.

Passwd-u ZGSJ//unlock ZSGJ user, allow ZGSJ user to log in

The locked user ZGSJ is unlocked and the user can log in.

2, we modify the/etc/passwd file in the user login shell to implement Linux prohibit user login

vi/etc/passwd

Root:x:0:0:root:/root:/bin/bash
Bin:x:1:1:bin:/bin:/sbin/nologin
Daemon:x:2:2:daemon:/sbin:/sbin/nologin
Adm:x:3:4:adm:/var/adm:/sbin/nologin
Lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
Sync:x:5:0:sync:/sbin:/bin/sync
Shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
Halt:x:7:0:halt:/sbin:/sbin/halt
Mail:x:8:12:mail:/var/spool/mail:/sbin/nologin
Uucp:x:10:14:uucp:/var/spool/uucp:/sbin/nologin
Operator:x:11:0:operator:/root:/sbin/nologin
Games:x:12:100:games:/usr/games:/sbin/nologin
Zgsj:x:500:500::/home/lynn:/bin/bash

Change to:

Zgsj:x:500:500::/home/lynn:/sbin/nologin

The user will not be able to log in.

3. Prohibit all users from logging in.

Touch/etc/nologin

Users other than root cannot log in.

Linux commands for creating users

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.