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

User and file rights management

2025-02-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

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

Experimental environment:

The Linux host of the company will be provided to the Technology Department for use as a development server. According to the composition of project groups in the department, it is necessary to establish corresponding group accounts and user accounts, and set permissions for relevant directories; it is also necessary to set up a common data storage directory to facilitate data exchange among colleagues.

Requirement Description:

1. Create a user directory.

Create directories/tech/benet and/tech/accp to host user accounts for each project group. For example, the hosting directory for kylin users should be located at/tech/benet/kylin.

Mkdir -p /tech/benet

Mkdir -p /tech/accp

Second, add a group account.

(1) Add group accounts benet and accp for two project groups, and set GID numbers to 1001 and 1002 respectively.

Groupadd benet -g 1001

Groupadd accp -g 1002

Tail -2 /etc/group

(2) Add a group account tech for the technology department, and set the GID number to 200.

Groupadd tech -g 200

Tail -3 /etc/group

Third, add user accounts.

(1) Benet group consists of three users, namely kylin, tsengia, obama. The host directory uses the folder with the same name as the account in/tech/benet/directory. Kylin user accounts were set to expire after March 15, 2013.

Useradd -d /tech/benet /kylin -g benet -G tech -e 2013-3-15 -s /sbin/nologin kylin

Useradd -d /tech/benet/tsengia -g benet -G tech tsengia

Useradd -d /tech/benet/obama -g benet -G tech obama

Tail -3 /etc/passwd

(2) Accp group includes two users, handy and cucci, and the host directory uses the folder with the same name as the account in the/tech/accp/directory. The login shell for cucci users is set to/bin/ksh.

Useradd -d /tech/accp/handy -g accp -G tech handy

Useradd -d /tech/accp/cucci -g accp -G tech -s /bin/ksh cucci

Tail -5 /etc/passwd

All of the above user accounts are required to join the tech group.

In the test phase, only the initial password "123456" is set for kylin, tsengia and handy, and other users do not set passwords temporarily.

Passwd kylin

Passwd tsengia

Passwd handy

1. Set directory permissions and ownership.

(1) Set the group of/tech directory to tech, removing all permissions of other users.

Chown :tech /tech

Ls -l /(View permissions, show 755)

Chmod 750 /tech

(2) Set the group of/tech/benet directory to benet, removing all permissions of other users.

Chown :benet /tech/benet

Chmod 750 /tech/benet

Ls -l /tech

(3) Set the group of/tech/accp directory to accp, removing all permissions of other users.

Chown :accp /tech/accp

Chmod 750 /tech/accp

Ls -l /tech

2. Establish a public data storage directory.

Create a/public directory that allows all users within the tech group to read, write, and execute files, and prohibits access to this directory by users outside the tech group.

Mkdir /public

Chown :tech /public

Chmod 070(770) /public

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

Network Security

Wechat

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

12
Report