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

Introduction and usage of linux file management and user management

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

Share

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

Linux file management and user management introduction and usage is how, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain in detail for you, people with this need can come to learn, I hope you can gain something.

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

[root@centos7 etc] # ls-d / etc/ [^ [: alpha:]] [: alpha:] *

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

[root@centos7 etc] # mkdir / tmp/mytest1 & & cp-a / etc/ [p] * [^ [: digit:]] / tmp/mytest1/

[root@centos7 etc] # ls / tmp/mytest1/ # View the result

Pam.d passwd- pinforc plymouth pnm2ppa.conf postfix prelink.conf.d profile protocols purple

Passwd pbm2ppa.conf pki pm popt.d ppp printcap profile.d pulse python

3. Convert the contents of the / etc/issue file to uppercase and save to the / tmp/issue.out file

[root@centos7 etc] # tr'a murz''Amurz'

< /etc/issue >

/ tmp/issue.out

[root@centos7 etc] # cat / tmp/issue.out View content

\ s

KERNEL\ R ON AN\ M

4. Summarize and describe how to use user and group management commands and complete the following exercises:

(1) create a group distro with a GID of 2019

[root@centos7 etc] # groupadd distro-g 2019

[root@centos7 etc] # getent group distro # verify the GID of distro

Distro:x:2019:

(2) create user mandriva, whose ID number is 1005; the basic group is distro

[root@centos7 etc] # useradd mandriva-u 1005-g distro

[root@centos7 etc] # id mandriva # verify the UID number and basic group of mandriva

Uid=1005 (mandriva) gid=2019 (distro) groups=2019 (distro)

(3) create user mageia, whose ID number is 1100 and home directory is / home/linux

[root@centos7 etc] # useradd mageia-u 1100-d / home/linux

[root@centos7 etc] # getent passwd mageia # Verification result

Mageia:x:1100:1100::/home/linux:/bin/bash

(4) add a password to the user mageia, the password is mageedu, and set the user password to expire after 7 days.

[root@centos7 etc] # echo "mageedu" | passwd mageia-- stdin-x 7

[root@centos7 etc] # getent shadow mageia # Verification result

Mageia:!!:18308:0:7:7:::

(5) delete mandriva, but keep its home directory

[root@centos7 etc] # userdel mandriva

[root@centos7 etc] # ls / home/ # Verification result mandriva directory still exists

Diyoujia linux mandriva slackware test

(6) create user slackware, whose ID number is 2002, basic group is distro, and additional group peguin

[root@centos7 etc] # useradd slackware-u 2002-g distro-G peguin

[root@centos7 etc] # id slackware # Verification result

Uid=2002 (slackware) gid=2019 (distro) groups=2019 (distro), 2020 (peguin)

(7) modify the default shell of slackware to / bin/tcsh

[root@centos7 etc] # chsh slackware-s / bin/tcsh

[root@centos7 etc] # getent passwd slackware # Verification result

Slackware:x:2002:2019::/home/slackware:/bin/tcsh

(8) add additional group admins for user slackware

[root@centos7 etc] # usermod slackware-aG admins

[root@centos7 etc] # id slackware # Verification result

Uid=2002 (slackware) gid=2019 (distro) groups=2019 (distro), 2020 (peguin), 2021 (admins)

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

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