Saturday, April 27, 2013

Disable ftp account of a specific user

If you want to disable ftp account of any user, you should follow these steps.

The process does not prevent user to log into shell prompt. User can log into shell prompt as well as execute the commands but he can't use ftp services.

If you are using debian or ubuntu. Run following command.
$ echo username >> /etc/ftpusers
If you are using centos or fedora. Run following command.
$ echo username >> /etc/vsftpd/ftpusers
The user will not be able to access ftp account.

If you do not want to use command line. Open file /etc/ftpusers or /etc/vsftpd/ftpusers (according to your distribution) and add username in the list.
To Allow access :
Just remove the username from the file ftpusers.
Restart vsftpd.

Enable ftp account of root

By Default, root is not able to access ftp because it's name in the list of /etc/ftpusers or /etc/vsftpd/ftpusers
Remove root from the list.
Restart vsftpd.
root will be able to log-in using ftp.

If you are using CentOS, fedora or RHEL and still you are not able to log in as root in your ftp server.
Add following line in the file vsftpd.conf
userlist_deny=YES
Remove user root fin the file /etc/vsftpd/user_list and restart vsftpd.
root should be able to log-in using ftp.

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.