Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How does Linux create new users and add groups?

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

1. Display / etc/ directory, starting with a non-character, followed by a letter and other files or directories of any length and any character

Use the ls command, combined with file wildcards, to find: man glob can find expressions of file wildcard symbols; [: alnum:] letters and numbers; [! [: alnum:]] non-letters and numbers; [: alpha:] uppercase and lowercase letters; * any character contains empty

2 copy all files or directories under the / etc directory that begin with p and end with non-numbers into the / tmp/mytest1 directory.

Mkdir / tmp/mytest1; cp-a / etc/p* [! [: digit:]] / tmp/mytest1

3 convert the contents of the / etc/issue file to uppercase and save to the / tmp/tr.txt file.

Tr is a standard input, output standard output software, can do conversion, do repeated character compression and deletion; can cooperate with the pipeline and > append to the file; tr [Amurz] [Amurz]

< /etc/issuecat /etc/issue | tr [a-z] [A-Z]tr [a-z] [A-Z] < /etc/issue | tee -a tr1.txtcat /etc/issue | tr [a-z] [A-Z] >

> tr2.txt

4 Please summarize and describe the usage of user and group management commands and complete the contact

Useradd userdel creates and deletes users; groupadd groupdel creates and deletes groups

4.1 create a group distro with a GID of 2019

Groupadd-g 2019 distro

4.2 create user mandriva with the ID number 1005; the basic group is distro

Useradd-u 1005-g distro mandriva

4.3.Create user mageia with ID number 1100 and home directory / home/linux

Useradd-u 1100-d / home/linux mageia

4.4 add a password to the user mageia with the password mageedu, and set the user password to expire after 7 days

Passwd-x 7 mageiaecho mageedu | passwd-stdin mageia

4.5 remove mandriva but keep its home directory

Userdel mandriva

Create a user slackware with the ID number 2002, the basic group distro, and the additional group peguin

Useradd-u 2002-g distro-G peguin slackware

4.7 modify the default shell of slackware to / bin/tcsh

Usermod-s / bin/tcsh slackware

4.8 add additional group admins for user slackware

Usermod-a-G admins slackware

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report