MAL - Memória Auxiliar do Lutieri

domingo, outubro 02, 2011

Playing with ACLs on File Systems

Enabling ACLs:
# mount -oremount,acl /


Before:
[root@zeus ~]# ll
total 20
-rw-------. 1 root root 1134 Oct 2 14:13 anaconda-ks.cfg
-rw-r--r--. 1 root root 8408 Oct 2 14:13 install.log
-rw-r--r--. 1 root root 3164 Oct 2 14:12 install.log.syslog
[root@zeus ~]# getfacl install.log
# file: install.log
# owner: root
# group: root
user::rw-
group::r--
other::r--


Giving user01 rwx permissions on install.log
[root@zeus ~]# setfacl -m u:user01:rwx install.log

After:
[root@zeus ~]# ll
total 24
-rw-------. 1 root root 1134 Oct 2 14:13 anaconda-ks.cfg
-rw-rwxr--+ 1 root root 8408 Oct 2 14:13 install.log
-rw-r--r--. 1 root root 3164 Oct 2 14:12 install.log.syslog
[root@zeus ~]# getfacl install.log
# file: install.log
# owner: root
# group: root
user::rw-
user:user01:rwx
group::r--
mask::rwx
other::r--

Removing the previous gaven permission:

[root@zeus ~]# setfacl -x u:user01 install.log
[root@zeus ~]# getfacl install.log
# file: install.log
# owner: root
# group: root
user::rw-
group::r--
mask::r--
other::r--


Assigning and removing multiple entries:
[user01@zeus ~]$ setfacl -m u:root:rw-,u:games:r-- a
[user01@zeus ~]$ getfacl a
# file: a
# owner: user01
# group: user01
user::rw-
user:root:rw-
user:games:r--
group::rw-
mask::rw-
other::r--
[user01@zeus ~]$ setfacl  -b a
[user01@zeus ~]$ getfacl a
# file: a
# owner: user01
# group: user01
user::rw-
group::rw-
other::r--

Managing File Systems

Volumes metadata:

# blkid
/dev/sda1: LABEL="Bootinho" UUID="7aa20f0f-49f4-4601-bd30-9067519bb6c5" TYPE="ext4"
/dev/sda2: UUID="sWPlWO-lcYm-SLk2-E5Ho-0a6T-kdBt-YZG79V" TYPE="LVM2_member"
/dev/mapper/vg_zeus-lv_root: UUID="0b494d0c-b2c2-4dbc-a73f-392bd4860ed4" TYPE="ext4"
/dev/mapper/vg_zeus-lv_swap: UUID="e6602180-14f2-4f22-811a-f9fedc7d0387" TYPE="swap"

Labeling a volume:


[root@zeus ~]# e2label /dev/sda1 Bootinho
OR
[root@zeus ~]# tune2fs -L booootinho /dev/sda1
tune2fs 1.41.12 (17-May-2010)
[root@zeus ~]# e2label /dev/sda1
booootinho
[root@zeus ~]#



Querying a volume's label
[root@zeus ~]# e2label /dev/sda1
Bootinho

Finding volumes with a specific name
[root@zeus ~]# findfs LABEL=Bootinho
/dev/sda1

Mount using volume's label

[root@zeus ~]# mount LABEL=Bootinho /boot/


Reparing an ext2/ext3/ext4 file system


[root@zeus ~]# umount /boot/
[root@zeus ~]# e2fsck -f /dev/sda1
e2fsck 1.41.12 (17-May-2010)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
booootinho: 38/128016 files (2.6% non-contiguous), 43796/512000 blocks


Resizing an ext2/ext3/ext4 file system
[root@zeus ~]# resize2fs -p /dev/sda1
resize2fs 1.41.12 (17-May-2010)
The filesystem is already 512000 blocks long.  Nothing to do!





Chat with Lutieri G. B.

Subscribe in a reader