Monday, August 19, 2013

Sticky Bit

What is Sticky Bit?

Sticky Bit is mainly used on folders in order to avoid deletion of a folder and its content by other users though they having write permissions on the folder contents. If Sticky bit is enabled on a folder, the folder contents are deleted by only owner who created them and the root user. No one else can delete other users data in this folder(Where sticky bit is set). This is a security measure to avoid deletion of critical folders and their content(sub-folders and files), though other users have full permissions.

Learn Sticky Bit with examples:

Example: Create a project(A folder) where people will try to dump files for sharing, but they should not delete the files created by other users.
How can I setup Sticky Bit for a Folder?
Sticky Bit can be set in two ways
  1. Symbolic way (t,represents sticky bit)
  2. Numerical/octal way (1, Sticky Bit bit as value 1)
Use chmod command to set Sticky Bit on Folder: /opt/dump/
Symbolic way:
chmod o+t /opt/dump/
or
chmod +t /opt/dump/
Let me explain above command, We are setting Sticky Bit(+t) to folder /opt/dump by using chmod command.
Numerical way:
chmod 1757 /opt/dump/
Here in 1757, 1 indicates Sticky Bit set, 7 for full permissions for owner, 5 for read and execute permissions for group, and full permissions for others.
Checking if a folder is set with Sticky Bit or not?
Use ls –l to check if the x in others permissions field is replaced by t or T

For example: /opt/dump/ listing before and after Sticky Bit set

Related Posts:

  • Fix lỗi không vào mạng khi clone centos với VMware Cách 1: At first, I checked the configuration of its NIC $ ping www.google.com ping: nuknown host www.google.com  $ cat /etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE="eth0" HWADDR="00:50:56:B0:7F:24" NM_CONTROLLED="n… Read More
  • Vòng đời của tên miền Quốc tếMỗi tên miền từ khi được khởi tạo đến lúc ngưng sử dụng đều có một "vòng đời" riêng của nó, thậm chí có những tên miền còn sở hữu nhiều vòng đời.Dưới đây, chúng tôi sẽ trình bày vòng đời của một số tên miền quốc tế thường sử … Read More
  • Thiết lập IP tĩnh cho cho centos 1, Để xác định địa chỉ ip và các network interface ta dùng command: Ifconfig –a 2, Để xem những thiết bị được kết nối vào computer từ IRQ 1 – IRQ 15 : Cat /proc/interrupts 3, Thiết lập địa chỉ ip tạm thời cho một card mạ… Read More
  • Vòng đời của tên miền VNTên miền ở trạng thái tự do (Available) => Chủ thể đăng ký sử dụng => Tên miền hết hạn. Sau 3 ngày kể từ ngày hết hạn => tên miền sẽ bị tạm ngưng, nhưng chủ thể vẫn có quyền nộp phí gia hạn trong vòng 17 ngày tiếp th… Read More
  • Quy định về tên miền Việt Nam (.VN) Định nghĩa các đuôi tên miền¶ COM.VN: Dành cho tổ chức, cá nhân hoạt động thương mại. BIZ.VN: Dành cho các tổ chức, cá nhân hoạt động kinh doanh, tương đương với tên miền COM.VN. EDU.VN: Dành cho các tổ chức, cá nhân hoạt đ… Read More