Friday, April 10, 2015

9 Good Ways To Protect Your Linux System




1. Use SELinux
SELinux is a security enhancement to Linux, which allows users and administrators more control over access control. SELinux adds finer granularity to access controls. Instead of only being able to specify who can read, write or execute a file, for example, SELinux lets you specify who can unlink, append only, move a file and so on.

2. Subscribe to a Vulnerability Alert Service
Your operating system may not necessarily be the one that is vulnerable. In fact, vulnerabilities are most often found in the applications that one installs. In order to avoid this, you must keep your applications updated to the newest version. In addition, subscribe to alert services like SecurityFocus.

3. Disable Unused Services and Applications
In general, users do not use half of the services and applications on their system for most of the time. These services and applications though are kept running, which could make for an invitation to attackers. It is best to keep unused services stopped.

4. Check System Logs
Your system logs tell you what activity has happened on the system, including whether an attacker has been successful in or tried to access the system. Being careful is your first line of defense and your system logs should be regularly monitored for this.

5. Consider Port Knocking
Setting up port knocking is a good way to establish a secure connection with a server. What basically happens is that a special package is sent to the server, which triggers a response/connection from the server. Port knocking is a good defensive manuever for those who have open ports on their systems.

6. Use Iptables
What is Iptables? This is an application framework, which allows the user to write their own powerful firewall for the system. So, learn how to write a good firewall and use the Iptables framework in order to do well.

7. Deny All by Default
Firewalls follow two philosophies: one is to allow every bit of traffic and the other is to deny access to everything, prompting you for permission. The second option is the better of the two. You should only allow the traffic that is important to come in.

8. Use an Intrusion Detection System
An Intrusion Detection System or IDS allows you to manage the traffic and attacks on your system better. Snort is arguably the best IDS for Linux that is available today.

9. Use Full Drive Encryption
Encrypted data is harder and sometimes impossible to steal, which is why you should keep your entire drive encrypted. This way if someone does get access to your system, they will still have a very hard time getting by the encryption. According to some reports, most data loss is through stolen machines.

Linux Command That Can Be Used To View System Info



1. arch
This command will show you the architecture of your system.
2. uname -m
This is another command to view the architecture of the system.
3. uname -r
This command is used to check the kernel version that is being used in the system.
4. dmidecode -q
This command give you the hardware components in your system.
5. hdparm-i /dev/hda
This is the command that shows the characteristics of your hard disk.
6. hdparm-tT /dev/sda
This command is used in order to conduct tests readings on hard drives.
7. cat /proc/cpuinfo
These commands can help you in getting CPU information.
8. cat / proc / interrupts
These commands are used to interrupt a process.
9. cat /proc/meminfo
This command verifies the memory usage in your system.
10. cat /proc/swaps
These commands are used in order to swap files.
11. cat /proc/version
These three commands can display the kernel version for your system.
12. cat /proc/net/dev
These four commands are used to view the network adapters and display statistics of the system.
13. cat /proc/mounts
This command shows you the mounted file system.
14. lspci-tv
If you need to view the PCI display devices then this is the command to use.
15. lsusb-tv
This is the command for displaying USB devices.

Sunday, April 5, 2015

Linux User Management



ac

Print statistics about users' connect time.
accton

Turn on accounting of processes. To turn it on type "accton /var/log/pacct".
adduser

Ex: adduser mark - Effect: Adds a user to the system named mark
chage

Used to change the time the user's password will expire.
chfn

Change the user full name field finger information
chgrp

Changes the group ownership of files.
chown

Change the owner of file(s ) to another user.
chpasswd

Update password file in batch.
chroot

Run command or interactive shell with special root directory.
chsh

Change the login shell.
edquota

Used to edit user or group quotas. This program uses the vi editor to edit the quota.user and quota.group files. If the environment variable EDITOR is set to emacs, the emacs editor will be used. Type "export EDITOR=emacs" to set that variable.
faillog

Examine faillog and set login failure limits.
finger

See what users are running on a system.
gpasswd

Administer the /etc/group file.
groupadd

Create a new group.
grpck

Verify the integrity of group files.
grpconv

Creates /etc/gshadow from the file /etc/group which converts to shadow passwords.
grpunconv

Uses the files /etc/passwd and /etc/shadow to create /etc/passwd, then deletes /etc/shadow which converts from shadow passwords.
groupdel

Delete a group.
groupmod

Modify a group.
groups

Print the groups a user is in
id

Print real and effective user id and group ids.
last

Display the last users logged on and how long.
lastb

Shows failed login attempts. This command requires the file /var/log/btmp to exist in order to work. Type "touch /var/log/btmp" to begin logging to this file.
lastcomm

Display information about previous commands in reverse order. Works only if process accounting is on.
lastlog

Formats and prints the contents of the last login.
logname

Print user's login name.
newgrp

Lets a suer log in to a new group.
newusers

Update and create newusers in batch.
passwd

Set a user's pass word.
pwck

Verify integrity of password files.
pwconv

Convert to and from shadow passwords and groups.
quota

Display users' limits and current disk usage.
quotaoff

Turns system quotas off.
quotaon

Turns system quotas on.
quotacheck

Used to check a filesystem for usage, and update the quota.user file.
repquota

Lists a summary of quota information on filesystems.
sa

Generates a summary of information about users' processes that are stored in the /var/log/pacct file.
smbclient

Works similar to an ftp client enabling the user to transfer files to and from a windows based computer.
smbmount

Allows a shared directory on a windows machine to be mounted on the Linux machine.
smbpasswd

Program to change users passwords for samba.
su

Ex: su mark - Effect: changes the user to mark, If not root will need marks password.
sulogin

Single user login.
ulimit

A bash builtin command for setting the processes a user can run.
useradd

Create a new user or update default new user information.
userdel

Delete a user account and related files.
usermod

Modify a user account.
users

Print the user names of users currently logged in.
utmpdump

Used for debugging.
vigr

Edit the password or group files.
vipw

Edit the password or group files.
w

Display users logged in and what they are doing.
wall

Send a message to everybody's terminal.
who

Display the users logged in.
whoami

Print effective user id.