Remote Administration Telnet, SSH, telnet

Wednesday, June 24, 2009
Your Ad Here
Remote Administration Telnet, SSH and telnet:
Telnet
Telnet is basically a virtual terminal program that helps you to configure a system remotely. In production environment, telnet is rarely used as it transfer keystroke in clear text.To enable telnet all you have to do is, run the following two commands
chkconfig telnet on
service xinetd restart
By default, telnet to remote system using root user is disabled. You have to log into the telnet server as a non-privileged user then you can change your identity as root using the following command –
su – root

SSH

Unlike telnet, ssh is considered a Secure Shell Service. Ssh runs on public/private key infrastructure using rsa or dsa technology.
It is very easy to start ssh. Execute service sshd restart command.
By default any user can establish ssh session. However, this can be controlled by modifying the /etc/ssh/sshd_config file. See the following screen shot. Here I have denied atanu and allowed all other users to establish an ssh session.
We can also allow or deny one or multiple group using AllowGroups or DenyGroups directive, like AllowGroups acct mrkt.
The modification can only be effected when you restart the ssh server.
Check the last two lines in the screen shot in the page –


In my network, I always use ssh to configure remote servers. Generally I configure my linux laptop as an ssh client. I have a RHEL 4 system and I use this particular computer to administer my proxy server that is running on 172.16.1.12. See, what I usually do –In my laptop I execute the following command to create the key –
ssh-keygen –t dsa
You can also use rsa here. See the following screen shot –


Check the output, in the screen shot, carefully. In the 3rd Line, it is saying the key will be saved in /root/.ssh directory. If the .ssh directory is not exist in /root, the sshkeygen command will create it, check the 4th line. After creating /root/.ssh directory, the system will ask you to supply the passphrase. I enter empty passphrase, means just press enter twice. My identification is now saved in /root/.ssh/id_dsa file and the public key is id_dsa.pub.
It is time to copy the id_dsa.pub in the /root/.ssh/ directory in my proxy server and the name of the file will be authorized_keys. I will be using the following command assuming in my proxy server, running on 172.16.1.12, the /root/.ssh directory exists.
scp –rp /root/.ssh/id_dsa.pub root@172.16.1.12:/root/.ssh/authorized_keys
See the output in the following screenshot. After executing the above command the system will ask your confirmation, type yes and press enter, supply root’s password for 172.16.1.12 and the file will be copied securely.

The scp will be discussed shortly.
Now, from your client computer if you execute ssh 172.16.1.12 the system will never ask you to supply the password!!


SCP

Using scp, you can copy files from or to a remote linux system. In ssh section above, see how we use scp to copy id_dsa.pub. To refer a remote system we use user@machin_name_or_ip_address:/any/directory and a source can also be a remote system.
While working with Windows system, I use winscp to communicate with linux system. The winscp382setup.exe is freely available for download in sourceforge.net.
Please be noted, when you establish an ssh or scp session with a computer for the first time, the remote system related information is added in /root/.ssh/known_hosts text file. And if the remote system is re-installed you will be failed to establish ssh or scp session until you remove the system’s information from the /root/.ssh/known_hosts file.

Labels: , , , , , , , , , , , , , , , , , , ,

 
posted by Gautam at 3:58 AM, | 0 comments

FTP SERVER

Monday, May 4, 2009
Your Ad Here
Setting up FTP server is a standard method for sharing files over the internet.
Two FTP server packages are provided with Linux RedHat 8 distribution, - the Washington
University FTPD (WUFTPD) and the Very Secure FTPD (VSFTPD).
Among the two, VSFTPD is considered to be better for high-volume FTP servers.
Access to the FTP server relies on a login process in the particular FTP server. Users with
their accounts on the system most likely have access to the greater part of the file system
after been authenticated comparing to ‘Anonymous’ user.
We will only concentrate to the VSFTPD configuration.
Setting up VSFTPD:
Start the VSFTPD FTP Server: Redhat 8
First of all check whether WUFTPD is running or not. To stop WUFTPD you must modify
the /etc/xinetd.d/wu-ftpd file. Replace the seeting
disable = no with disable = yes.
Edit the /etc/xinetd.d/vsftpd file by replacing the setting
disable = yes with disable = no
Restart the xinetd server by running the following command –
service xinetd restart or
/etc/init.d/xinetd restart
At this point, by default, anonymous users are given ‘read-only’ access to files and
subdirectories in /var/ftp.
Authenticated local users get access to their respective home directories.
With RHEL 3 or RHEL 4 starting ftp service is really simple. All you have to do is
exetcute the following command - service vsftpd restart .
To Start the ftp service in booting time, execute chkconfig vsftpd on
The vsftp ftp service configuration file is vsftpd.conf In case of Redhat 8, you will find
this file in /etc/ folder. In RHEL 3/4 you will find the file in /etc/vsftpd/ directory.
The vsftpd.conf file:
Configuration for the anonymous users:
By default, the anonymous users have read-only access to /var/ftp directory. The
default location for anonymous users can be changed by keeping the following directive in
the vsftpd.conf file – anon_root=/var/new .
Please be noted, whenever you modify the vsftpd.conf file, you need to restart the ftp service.
The anonymous_enable=YES option in vsftpd.conf file lets the anonymous users to access
the /var/ftp directory. It is the default setting.
If you want to disable anonymous access modify the
anonymous_enable=YES to anonymous_enable=NO
We can allow anonymous users to upload files using –
anon_upload_enable=YES option, provided that the directory or directories, where the
filess will be uploaded, are exist with write permission. For the security reason it is
always better to create a directory in /var/ftp with 777 permission – where the
anonymous users will upload their files.
Create a directory, say, public
mkdir /var/ftp/public
Set the permission
chmod 777 –R /var/ftp/public
We must keep in mind, ownership will be granted to ftp user for the files uploaded by
anonymous users. So, it is understandable, anonymous users get read-only access to the uploaded files.
If you want to allow the anonymous users to rename or delete the files in
/var/ftp/public directory, place the following option in the vsftpd.conf file –
anon_other_write_enable=YES
If you want to allow the anonymous users to create their own directory in the
/var/ftp/public directory, place the following option in the vsftpd.conf file –
anon_mkdir_write_enable=YES
If you want to configure the FTP server so that a particular user, say Linuxuser, will be
granted the ownership of the files uploaded by the anonymous users, place the following
options in the vsftpd.conf file –
chown_uploads=YES
chown_username=Linuxuser
Do not forget to restart ftp service –
service vsftpd restart

Labels: , , , , , , ,

 
posted by Gautam at 10:43 PM, | 0 comments