Shell Environment Variables
There are specific environment variables that the bash shell uses by default to define the system environment.
The most important environment variable in this list is the PATH environment variable. When you enter a command in the shell command line interface (CLI), the shell must search the system to find the program. The PATH environment variable defines the directories it searches looking for commands.
The PATH environment variable looks like this.
root@dell:~# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
This shows that there are six directories where the shell looks for commands. Each directory in the PATH is separated by a colon. The PATH also shows the order in which it looks for commands.
The individual directories listed in the PATH are separated by a colon. All you need to do is reference the original PATH value, and add any new directories to the string.
$ PATH=$PATH:/home/buddy/bin
How can I make a Webmin user always use the same password as their shell login?
This can be done by following these steps :
In the Perl Modules module of Webmin.
install Authen::PAM from CPAN.
In the PAM Authentication module, add a new PAM service called webmin that uses Unix authentication.
In the Webmin Users module, click on the user that you want to symchronize with Unix and set his Password option to Unix Authentication.
If PAM is not used on your operating system, the first two steps can be skipped.
Webmin will instead read the /etc/passwd or /etc/shadow file directly to authenticate users who are using the Unix Authentication password mode.
How to Encrypt Shell Script
We all know that anyone can read shell script.Think if any one gets access to the shell script which has root password and all stored in it. Its really a security risk. Now we have a solution for that ie all this risk can be avoided if the shell script is encrypted and then executed. The utility used for that is called shc
I will explain how to install it and then use it for the encrypting purpose
1) Download from http://www.datsi.fi.upm.es/~frosal/sources/shc-3.7.tgz
wget http://www.datsi.fi.upm.es/~frosal/sources/shc-3.7.tgz
2) Untar it
3) To install it follow the below given steps
cd shc-X.X/
make
make install
4) After install it will create a binary called shc, use it to encrypt the shell scripts
5) Write a shell script, lets call it heloworld.sh
#!/bin/bash
echo ” Helo world ”
6) To test shc execute the command
Option -f is used to encrypt
7) Now you will get an encrypted version of the script. It will be named something like heloworld.sh.x
Its an encrypted version and you can execute it as you wish
9) You have an encrypted shell script.
How can I see all running processes from the shell ?
Use either: