Archive for the ‘Linux Security’ Category

How to disable selinux

In this article we are going to check how to disable SELinux in Centos Box.SELinux brings lot of security measures to your Linux box.It will provide an additional level of access control mechanism to files and folders on top of normal Linux security tools.

Configure NAT in Linux box using IPTABLES

NAT-Network Address Translation is used to communicate from one network to other network with different sub-net.So your Linux box will act as a gateway and will allow to communicate between two different networks.

Manage password aging in Linux systems

password expiry for users is configuring in /etc/login.defs file.These are the password aging parameters PASS_MAX_DAYS                Maximum number of days a password may be used. PASS_MIN_DAYS                 Minimum number of days allowed between password changes. PASS_WARN_AGE               Number of days warning given before a password expires. By default PASS_MAX_DAYS will be 99999 days that means no password expiry.So we are going to configure password expiry for all users in 90 days and minimum days between password change is 1 day. Open /etc/login.defs and [...]

Brief history of SELinux

selinux is created by National Security Agency. NSA created a project to enforce Mandatory Access Control (MAC) inside the Linux Kernel which is known as Security Enhanced Linux or SELinux

Synchronize data between two servers using rsync

Rsync: rsync is an application used in unix systems which synchronize files and directories between two machines.rsync behaves like rcp(remote file copy),but it much faster than rcp.because rsync sends the differences in the files instead of sending entire files. Servers are SERVER_SOURCE & SERVER_DESTINATION Configure SSH key authentication In SERVER_DESTINATION open sshd_config file vi /etc/ssh/sshd_config Then verify the following entries RSAAuthentication yes PubkeyAuthentication yes AuthorizedKeysFile .ssh/authorized_keys save & exit Then restart ssh daemon /etc/init.d/sshd restart Then in SERVER_SOURCE, create a [...]

How to set password for GRUB

Login as root user Enter grub mode: # grub Use md5crypt to encrypt password: grub> md5crypt Password: ****** Encrypted: $1$jxcdN0$hVHViq1aiPf8FziuGJGZp0 Copy encrypted password Exit grub mode: grub> quit Modify file /boot/grub/grub.conf: vi /boot/grub/grub.conf Insert this line after splashimage  “password –md5 $1$jxcdN0$hVHViq1aiPf8FziuGJGZp0″ splashimage=(hd0,0)/boot/grub/splash.xpm.gz password –md5 $1$jxcdN0$hVHViq1aiPf8FziuGJGZp0 then save& exit /boot/grub/grub.conf

Monitoring external access to your system

login as root and execute the following command #watch lsof -i To list all open Internet files, use: #lsof -i -U You can also get very specific about ports. Do this as root for low ports. #lsof -i TCP:3306 Or, look at UDP ports as follows: #lsof -i UDP:1812 Also try fuser. Suppose you have a mounted file-system, and you need to umount it. To list the users on the file-system /work #fuser -u /work To kill all processes accessing [...]

Monitor Network Traffic using tcpdump

To monitor all Network Traffic Except Your Current ssh Connection, #tcpdump -i eth0 -nN -vvv -xX -s 1500 port not 22 To filter out port 123 as well getting the full length of the packet (-s 0), use the following: #tcpdump -i eth0 -nN -vvv -xX -s 0 port not 22 and port not 123 Or to filter only a certain host say 117.169.104.250 #tcpdump -i eth0 -nN -vvv -xX port not 22 and host 81.169.158.205 Just want ip addresses [...]

Allow non root users to run root programs

When a user starts a command, it runs with the permissions of that user. What if you want to allow them to run some commands with root permissions? You can, and that’s called suid.So  SUID permission makes a script to run as the user who is the owner of the script, rather than the user who started it. You can set a command to be suid root with the chmod command. This will make it run as root even if [...]

How to create a welcome banner for SSH logins

Open /etc/ssh/sshd_config using vi editor vi /etc/ssh/sshd_config Then uncomment the line #Banner /etc/motd save & exit Now create some banner text in /etc/motd like This computer system is for authorized users only. All activity is logged and regulary checked by systems personal. Individuals using this system without authority or in excess of their authority are subject to having all their services revoked. Any illegal services run by user or attempts to take down this server or its services will be [...]

How to view active ssh sessions on your Server

By using lsof command,we can view active ssh connections on your server.So let’s find out how.
lsof command is used to list open files like disk files, pipes, network sockets and devices opened by all processes.

Related Posts Plugin for WordPress, Blogger...