Tuesday, April 23, 2013

Install webmin on Linux - CentOS, Fedora, Debian or Ubuntu

Download webmin from here.

1) If your Linux distribution is yum based like CentOS or fedora,
Download rpm file of webmin and install it using 
$ sudo rpm -ivh webmin-installation-filename.rpm
If your Linux distribution is dpkg(deb) based like ubuntu or debian,
Download deb file of webmin and install it using 
$ sudo dpkg -i webmin-installation-filename.deb

2) Now webmin is installed and we can access it using port 10000, Open it.
https://localhost:10000

3) If your firewall prevents to access webmin using other system of same LAN, you should define port 10000 in iptables.
Add following line in /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 10000 -j ACCEPT

4) Restart iptables
$ sudo service iptables restart

5) Now you can access it using
https://ip-of-the-server:10000

6) username, password of webmin is same as root's username & root's password of the server.


webmin - Security Warning

Warning! Webmin has detected that the program 
https://IP-address:10000/right.cgi?open=system&open=status was linked to from an unknown URL, which appears to be outside the Webmin server. This may be an attempt to trick your server into executing a dangerous command.

First Method :
  • Login as root, and edit the /etc/webmin/config file.
  • Find the line referers_none=1 and change it to referers_none=0.
  • Save the file.
Second Method :
  • Login to Webmin normally.
  • Go to the Webmin Configuration module.
  • Click on the Trusted Referrers icon.
  • Check the Trust links from unknown referrers box, and click Save.
Final Method :
If above both methods do not work, follow this.
Open following link in chrome
Select radio button NO for Referrer checking enabled?
Now try again.

webmin - Error - Bad Request

Open webmin url with https
The correct url is https://localhost:10000/webmin

Monday, April 22, 2013

Log-in as root on Linux Terminal

I am going to show you three most used methods to log-in as root.

First way :
If you have sudo privileges as a user, you can use following command to log-in as root on terminal.
$ sudo -i
It asks for your (user's) password. After enter your password, you can log-in as root on terminal.

Second way :
$ su - or $ su - root
It asks for root's password. If you know root's password, you can log-in as root.

Third way:
You can log-in as root using secure shell (ssh)
$ ssh ip-of-the-server

If client and server are two different systems, the first two methods do not work to log-in as root on server. Only third method will work.

If client and server are in same system (root and users are in same system) , the first two methods do not require internet to log-in as root on terminal.

Third method requires internet to log-in as root on terminal.

Disable sudo privileges for user

If you want, user should not execute command with sudo.
To remove sudo permissions for user, follow the process.

1. Change the group of user. To see how to change the group of a user click here.

2. Do not define the group in file /etc/sudoers
     A group-name is started with symbol % in  /etc/sudoers
     Comment the line in /etc/sudoers
    #%group-name ALL=(ALL) ALL
Above line without comment gives sudo permission to all users of the group.
If you comment this line, no user of the group can use sudo while executing any command.

3. Now whenever user tries to run command with sudo, it says
 Error - username is not in the sudoers file. This incident will be reported.