Permissions
Modify file / folder permission
chmod o+W file (o for others, add write permission) chmod 600 file (remove all permission group and other) chmod ugo+rwx (add rwx permissiom to user. group and other) chmod ugo-rwx (remove rwx) chmod g+s file
Change ownership
chown username filename (change user ownship) chown username:groupname file (change user/grp ownership) chgrp groupname file (change group ownership) chown -R username directory change ownership recusively on directory)
Change immutable bit, make the file read only even root
chattr +i filename (+i for add, -i for remove) list immutable bit lsattr filename
Change directory permission for user collaboration
chmond 2070 directory(2 means group will have the ownership of file)
Networking
Assign ip address to an interface (won’t survive after a reboot)
ifconfig eth1 x.x.x.x netmask x.x.x.x
Shut/bring up an interface
ifdown/ifup eth1
To view routing table
route ip route
To add default route
route add default gw x.x.x.x dev eth1
To view ip details
ip addr show ip -s link ifconfig
To get ip address from dhcp
dhclient eth1
Iptables
To list rule
iptables -L
To flush the rules
iptables -F
To save the changes
service iptables save
To add a rule (accept a traffic of tcp port 21)
iptables -I INPUT -p tcp --dport 21 -j ACCEPT
To remove a rule
iptables -D INPUT -p tcp --dport 21 -j ACCEPT
GUI TOOL
um install system-config-firewall
Here’s part two of the cheat sheet