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

Ubuntu system gives disk quota (Quota)

2025-01-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

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

Requirements: disk quota for U disk, different usage capacity for different users

Step 1: install the quota command

Sudo apt-get install quota

Step 2: partition the USB disk. All the capacity is divided into one partition.

Sudo fdisk / dev/sdb

N-> p-> Enter- > w

Step 3: format the partition (ext3)

Sudo mkfs.ext3 / dev/sdb1

If you are required to enter information, just Enter (enter)

Step 4: Mount the partition / dev/sdb1

Sudo mkdir / mnt/quotadir

Sudo mount / dev/sdb1 / mnt/quotadir/

Mount | grep sdb1

Step 5: quota permissions for this directory

Sudo mount-o remount,usrquota,grpquota / mnt/quotadir/

Mount | grep sdb1

Step 6: create a quota record file and scan it with quotacheck.

Sudo quotacheck-avug

Step 7: turn the quota service on and off

Open: sudo quotaon-vug / mnt/quotadir/

Close: sudo quotaoff-vug / mnt/quotadir/

Step 8: create two users in the same group, and then set a space quota for these two users.

Sudo groupadd quotagroup

Cat / etc/group | grep quotagroup

Sudo useradd-g quotagroup quotauser1

Sudo useradd-g quotagroup quotauser2

Cat / etc/passwd | grep quota

Step 9: assign quotas to specified users or groups

Assign 250m quota to quotauser1, which cannot exceed 300M:sudo edquota-u quotauser1

Assign 250m quota to quotauser2, which cannot exceed 300M:sudo edquota-u quotauser2

In the same way, the second user wrote it himself.

Assign 500m quota to quotagroup group, which cannot exceed 600M:sudo edquota-g quotagroup

Set a grace period of 14 days: sudo edquota-t

Step 10: show the quota phenomenon of users or groups

Show user quota: sudo quota-uvs quotauser1 quotauser2

Show group quotas: sudo quota-gvs quotagroup

Step 11: display quota information for the file system

Display user: sudo repquota-auvs

Show group: sudo repquota-agvs

Step 12: test whether it is effective

Switch user: sudo su quotauser1

Create a large file: dd if=/dev/zero of=bigfile bs=1M count=270

Switch back to primary user view: sudo repquota-auvs

When writing again, an error will be reported, and only the capacity of the upper limit value can be written.

Over and out.

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