Category: Linux Interview questions
Symmetric Encryption Vs Asymmetric Encryption
- Symmetric encryption is the oldest and best-known technique.
- A secret key, which can be a number, a word, or just a string of random letters, is applied to the text of a message to change the content in a particular way.This might be as simple as shifting each letter by a number of places in the alphabet.
- Symmetric encryption uses the identical key to both encrypt and decrypt the data.
- As long as both sender and recipient know the secret key, they can encrypt and decrypt all messages that use this key.
Examples of Symmetric Encryption includes: DES, Triple-DES (3DES), IDEA, CAST5, BLOWFISH, TWOFISH.
- This encryption technique is born from the disadvantage of Symmetric Encryption.
- Asymmetric encryption, in which there are two related keys–a key pair(A public Key and a Private Key).
- A public key is made freely available to anyone who might want to send you a message. A second, private key is kept secret, so that only you know it.
- Any message (text, binary files, or documents) that are encrypted by using the public key can only be decrypted by applying the same algorithm, but by using the matching private key.
- Any message that is encrypted by using the private key can only be decrypted by using the matching public key.
Examples of Asymmetric Encryption includes: RSA, DSA.
Linux interview questions
Q: How are device files represented in UNIX/Linux?
A: All devices are represented as files called special files and are located in the /dev directory.
Q: What is a inode?
The inode(Index node) is a fundamental concept in Linux/Unix file systems. Each object in the file system is represented by an inode. Each and every file in Linux/Unix file systems has the following attributes.
File type (executable, block, special etc)
Permissions (read, write etc)
File access, change, modification time, file deletion time
Extended attribute information such as append only or no one can delete file including root user (immutability)
Access control lists (ACL)
All the above information are stored in an Inode. Each inode is identified by a unique inode number within the file system.
Q: how can I see an inode no?
A: # ls –i /etc/passwd
Output: 32820 /etc/passwd
We can use the ‘stat’ command to find out inode number and it’s attributes.
What are the process states in unix/linux?
Process states in Linux are below
Running: process is running or ready to run.
Interruptible: a Blocked state of a process and waiting for an event or signal from another process
Uninterruptible: a blocked state. Process waits for a hardware condition and cannot handle any signal
Stopped: Process is stopped or halted and can be restarted by some other process
Zombie: process terminated, but information is still there in the process table.
Q: Command used to remove password assigned to a group?
Q: How to find what shell we are using ?
Q: How to find files which have been accessed within the last 30 days?
Find / -type f -atime -30 > output.txt
“-30” means that it was modified “less than 30 days ago”
“+30” means that it was modified “more than 30 days ago”
For modified we can use “mtime”
Q: What is a zombie?
process terminated, but information is still there in the process table
Q: How do I find a zombie process
A: use ‘top’ or ‘ps’
a process with Z is a Zombie process and it can be killed using “kill -9 <process id>”
Q: Which daemon is responsible for tracking events in the system?
Q: What is the role of a /boot directiory?
This directory has files related to the system bootloader (grub/lilo)
Given a typical CentOS or Fedora host, you will probably see something similar to the following in /boot:
$ cd /boot
| `– EFI
| `– redhat
| `– grub.efi
| |– device.map
| |– e2fs_stage1_5
| |– fat_stage1_5
| |– ffs_stage1_5
| |– grub.conf
| |– iso9660_stage1_5
| |– jfs_stage1_5
| |– menu.lst -> ./grub.conf
| |– minix_stage1_5
| |– reiserfs_stage1_5
| |– splash.xpm.gz
| |– stage1
| |– stage2
| |– ufs2_stage1_5
| |– vstafs_stage1_5
| `– xfs_stage1_5
For each kernel release, you will typically see a vmlinuz, System.map, initrd and config file. The vmlinuz file contain the actual Linux kernel, which is loaded and executed by grub. The System.map file contains a list of kernel symbols and the addresses these symbols are located at. The initrd file is the initial ramdisk used to preload modules, and contains the drivers and supporting infrastructure (keyboard mappings, etc.) needed to manage your keyboard, serial devices and block storage early on in the boot process. The config file contains a list of kernel configuration options, which is useful for understanding which features were compiled into the kernel, and which features were built as modules.