Author: Ruwantha Nissanka

How to check who’s logged in to your linux machine

If you have a linux server, It is absolutely necessary to know how to check the users that are logged in to your system and what they are doing. To do that, you have to get yourself familiar with number of different linux commands. In this guide, we will show you how to identify the user accounts on a linux system using commands like whoami, id, and more. WHOAMI First of all, you need to check the username that you have used to log in. We can use the following command to see our username #whoami As you can see, The whoami command tells you your username. Who The who command will give you information about who is logged on the system. #who W The w command shows you who is logged on and what they are doing. #w ID The id command will give you your user id, primary group id, and a list of the groups that #id On RHEL/CentOS you will also get SELinux context information with this command. Finger Finger is another useful command that we can use to monitor the logged in users. It can also show how long they’ve been idle (how long since they ran a command), etc. In this command, we are looking at the user root. #finger rd We can see rd’s full name, home directory and shell. We can...

Read More

Encrypting directories with eCryptfs in linux

eCryptfs is a POSIX-compliant enterprise-class stacked cryptographic filesystem for Linux. It is derived from Erez Zadok’s Cryptfs, implemented through the FiST framework for generating stacked filesystems. eCryptfs extends Cryptfs to provide advanced key management and policy features. eCryptfs is already included in the official Ubuntu repositories and encrypting directories is a simple matter of mounting them with the ecryptfs filesystem You can install ecryptfs using the following command #sudo apt install ecryptfs-utils Create a secrets directory in the top level of the filesystem, and encrypt it. Note how you list the directory name twice, because you also need to specify a mount point. Essentially, you’re using the directory that you’re mounting as its own mount point: #sudo mkdir /secrets #sudo mount -t ecryptfs /secrets /secrets Enter your desired passphrase, and choose the encryption algorithm and the key length Go with the default of aes encryption, and 16 bytes for the key. Go with the default of no for plaintext passthrough, and with yes for filename encryption: Go with the default Filename Encryption Key and verify the mounting options: This warning only comes up when you mount the directory for the first time. For the final two questions, type yes in order to prevent that warning from coming up again Create a file within your new encrypted secrets directory, and then unmount the directory. Then, try to do a directory...

Read More

Encrypting files in linux

You may work for a super-secret government agency, or you may be just a regular citizen. Either way, you still have sensitive data in your linux system that you need to protect from prying eyes. For that, we can use GNU Privacy Guard to encrypt or cryptographically sign files or messages in our linux machine. GPG uses strong, hard-to-crack encryption algorithms and You can use GPG to just encrypt your own files for your own use Create your pair of GPG keys The first thing you need to know is how to create your GPG keys. #gpg --gen-key The first thing that this command does is to create a populated .gnupg directory in your home directory: You’ll then be asked to provide your personal information: Verify that the keys did get created: While you’re at it, take a look at the files that you created: These files are your public and private keyrings, your own gpg.conf file, a random seed file, and a trusted users database. Symmetrically encrypting your own files You may find GPG useful for encrypting your own files, even when you never plan to share them with anyone else. For this, you’ll use symmetric encryption, which involves using your own private key for encryption. Create a file using the following command #touch secret.txt Encrypt it using the following command #gpg -c secret.txt You will be prompted...

Read More

Over 16,000 readers, Get fresh content from “The Linux juggernaut”

Email Subscribe

ABOUT ME..!

My photo
My name is Surendra Kumar Anne. I hail from Vijayawada which is cultural capital of south Indian state of Andhra Pradesh. I am a Linux evangelist who believes in Hard work, A down to earth person, Likes to share knowledge with others, Loves dogs, Likes photography. At present I work at Bank of America as Sr. Analyst Systems and Administration. You can contact me at surendra (@) linuxnix dot com.