interview question and answer

December 15, 2011

How to configure linux ftp server step by step guide Example and Implementation

ftp server is used to transfer files between server and clients. All major operating system supports ftp. ftp is the most used protocol over internet to transfer files. Like most Internet operations, FTP works on a client/ server model. FTP client programs can enable users to transfer files to and from a remote system running an FTP server program.
Any Linux system can operate as an FTP server. It has to run only the server software—an FTP daemon with the appropriate configuration. Transfers are made between user accounts on client and server systems. A user on the remote system has to log in to an account on a server and can then transfer files to and from that account's directories only.
A special kind of user account, named ftp, allows any user to log in to it with the username “anonymous.” This account has its own set of directories and files that are considered public, available to anyone on the network who wants to download them.
The numerous FTP sites on the Internet are FTP servers supporting FTP user accounts with anonymous login. Any Linux system can be configured to support anonymous FTP access, turning them into network FTP sites. Such sites can work on an intranet or on the Internet.

Configuring the ftp Server

The vsftpd RPM package is required to configure a Red Hat Enterprise Linux system as an ftp server. If it is not already installed, install it with rpm commands as described in our pervious article. After it is installed, start the service as root with the command service vsftpd start . The system is now an ftp server and can accept connections. To configure the server to automatically start the service at boot time, execute the command chkconfig vsftpd on as root. To stop the server, execute the command service vsftpd stop. To verify that the server is running, use the command service vsftpd status.

Configure vsftpd server

In this example we will configure a vsftpd server and will transfer files from client side.
For this example we are using three systems one linux server one linux clients and one windows xp clients. To complete these per quest of ftp server Follow this link
  • A linux server with ip address 192.168.0.254 and hostname Server
  • A linux client with ip address 192.168.0.1 and hostname Client1
  • A window client with ip address 192.168.0.2 and hostname Client2
  • Updated /etc/hosts file on both linux system
  • Running portmap and xinetd services
  • Firewall should be off on server
We have configured all these steps in our pervious article.
We suggest you to review that article before start configuration of ssh server. Once you have completed the necessary steps follow this guide.
Three rpm are required to configure ssh server. vsftpd, portmap, xinetd check them if not found then install
rpm
Now check vsftpd, portmap, xinetd service in system service it should be on

#setup
Select System service from list
[*]portmap
[*]xinetd
[*]vsftpd
Now restart xinetd and portmap and vsftpd service
service restart
service vsftpd restart
To keep on these services after reboot on then via chkconfig command
chkconfig
After reboot verify their status. It must be in running condition
service status
Create a normal user named vinita
useradd
Login for this user on other terminal and create a test file
create file

On Linux client

ping from ftp server and run ftp command and give username and password
user login ftp server
after login you can download files from the specified directories

Most commonly commands used on ftp prompt are


put     To upload files on server
get     To download files from server
mput    To upload all files
mget    To download all files
?       To see all available command on ftp prompts
cd      To change remote directory
lcd     To change local directory
help commands on ftp server

On window clients

Now go on window clients and create a file. copy con command is used to create files on window. To save use CTRL+Z
copy con
Now ping from ftp server and invoke ftp session from server, login from user account and download as well as uploads files
user login on window system

Enable root account for ftp session and set permission on user

By default on vsftpd server root account is disable. You cannot login from root account.
deny root for ftp sessions
Now we will enable root account for ftp session and same time we will disable our normal user vinita to use ftp sessions.
open file /etc/vsftpd/ftpusers . Users whose name are set in this file will not allowed to login from ftp.
vi ftpuser
ftp user
By default this file have an entry for root that why root are not allowed to use ftp. remove root from list and add user vinita
ftp user
Now remove entry form /etc/vsftpd/user_list files. Users whose names are set in this file are also not allowed to login from ftp even they are not prompt for password.

userlist
By default this file have an entry for root that way root is denied form login even not asked for password remove root from list and add user vinita
userlist
After saving change in these files restart the vsftpd service
service vsftpd restart
Now go on client system and login from root this time root will login
root login
Now try to login form user vinita she should not prompt form password also
deny vinita

How to set login banner for ftp server

To set login banner open /etc/vsftpd/vsftpd.conf file and search for this tag
banner
Uncomment this tag and set your banner and save file , and restart the vsftpd service
banner
Go on client system and check banner it will appear before user login

December 14, 2011

How to configure linux ssh server step by step guide Example and Implementation

Telnet and FTP are well-known protocol but they send data in plain text format, which can be captured by someone using another system on the same network, including the Internet.
On the other hand, all data transferred using OpenSSH tools is encrypted, making it inherently more secure. The OpenSSH suite of tools includes ssh for securely logging in to a remote system and executing remote commands, scp for encrypting files while transferring them to a remote system, and sftp for secure FTP transfers.
OpenSSH uses a server-client relationship. The system being connected to is referred to as the server. The system requesting the connection is referred to as the client. A system can be both an SSH server and a client. OpenSSH also has the added benefits of X11 forwarding and port forwarding.
X11 forwarding, if enabled on both the server and client, allows users to display a graphical application from the system they are logged in to on the system they are logged in from.
Port forwarding allows a connection request to be sent to one server but be forwarded to another server that actually accepts the request.
In this article we will discusses how to use OpenSSH, both from the server-side and the client-side.

Configuring the ssh Server

The openssh-server RPM package is required to configure a Red Hat Enterprise Linux system as an OpenSSH server. If it is not already installed, install it with rpm commands as described in our pervious article. After it is installed, start the service as root with the command service sshd start . The system is now an SSH server and can accept connections. To configure the server to automatically start the service at boot time, execute the command chkconfig sshd on as root. To stop the server, execute the command service sshd stop. To verify that the server is running, use the command service sshd status.

Configure ssh server

In this example we will configure a ssh server and will invoke connection from client side.
For this example we are using two systems one linux server one linux clients . To complete these per quest of ssh server Follow this link
  • A linux server with ip address 192.168.0.254 and hostname Server
  • A linux client with ip address 192.168.0.1 and hostname Client1
  • Updated /etc/hosts file on both linux system
  • Running portmap and xinetd services
  • Firewall should be off on server
We have configured all these steps in our pervious article.
We suggest you to review that article before start configuration of ssh server. Once you have completed the necessary steps follow this guide.
Three rpm are required to configure ssh server. openssh-server, portmap, xinetd check them if not found then install
rpm
Now check sshd, portmap, xinetd service in system service it should be on

#setup
Select System service from list
[*]portmap
[*]xinetd
[*]sshd
Now restart xinetd and portmap and sshd service
service restart
ssh restart
To keep on these services after reboot on then via chkconfig command
chkconfig
After reboot verify their status. It must be in running condition
service status
Create a normal user named vinita
useradd

On Linux client

ping from ssh server and run ssh command and give root password
root login
By default ssh command will enable root session. If you want to login from normal user then specify his name with -l options.
user login
With ssh you can run any command on server without login (user password require)
ssh command

December 13, 2011

How to configure linux telnet server step by step guide Example and Implementation

telnet server is used to login into another system. You can use the telnet command to log in remotely to another system on your network. The system can be on your local area network or available through an Internet connection. Telnet operates as if you were logging in to another system from a remote terminal. You will be asked for a login name and password. In effect, you are logging in to another account on another system. In fact, if you have an account on another system, you could use Telnet to log in to it.
You invoke the Telnet utility with the keyword telnet. If you know the name of the site you want to connect with, you can enter telnet and the name of the site on the Linux command line.
CAUTION The original version of Telnet is noted for being very insecure. For secure connections over a network or the Internet, you should use the Secure Shell (SSH). We will cover SSH server in next article. SSH operate in the same way as the original but use authentication and encryption to secure the Telnet connection. Even so, it is advisable never to use Telnet to log in to your root account. That why by defaults root account is disable for root login.

Configure telnet server

In this example we will configure a telnet server and will invoke connection from client side.
For this example we are using three systems one linux server one linux clients and one window clients. To complete these per quest of telnet server Follow this link
  • A linux server with ip address 192.168.0.254 and hostname Server
  • A linux client with ip address 192.168.0.1 and hostname Client1
  • A windows xp system with ip address 192.168.0.2 and hostname Client2
  • Updated /etc/hosts file on both linux system
  • Running portmap and xinetd services
  • Firewall should be off on server
We have configured all these steps in our pervious article.
We suggest you to review that article before start configuration of telnet server. Once you have completed the necessary steps follow this guide.
Four rpm are required to configure telnet server. telnet, telnet-server, portmap, xinetd check them if not found then install
rpm
Now check telnet, portmap, xinetd service in system service it should be on

#setup
Select System service from list
[*]portmap
[*]xinetd
[*]telnet
Now restart xinetd and portmap service
service restart
To keep on these services after reboot on then via chkconfig command
chkconfig
After reboot verify their status. It must be in running condition
service status
Create a normal user named vinita

On Linux client

ping from telnet server and run telnet command and give user name and password
telnet form linux

On Window client

ping from telnet server and run telnet command
telnet
Give user name and password
user login

How to enable root login from telnet server

On linux server open file securetty
securetty
In the end of file add pts/0 to enable one telnet session for root. if you need to open more telnet session for root and add more pts/1 pts/2 and so on.
editing in securetty
Now restart xinetd and portmap service
service restart
Verfiy from window by login from root
root login telnet

How to configure linux print server step by step guide Example and Implementation

Linux uses the Common UNIX Printing System, also known as CUPS. CUPS uses the Internet Printing Protocol (IPP) to allow local printing and print sharing. The /etc/cups/ directory stores all the configuration files for printing. However, these files can be easily managed with the Printer Configuration Tool in Linux.
Exam question Raw (Model) printer named printer1 is installed and shared on 192.168.0.254. You should install the shared printer on your PC to connect shared printer using IPP Protocols.
Exam question Raw printer named printerx where x is your station number is installed and shared on server1.example.com. Install the shared printer on your PC to connect shared printer using IPP Protocols. Your server is 192.168.0.254.
Before you can use any printer, you first have to install it on a Linux system on your network. To start the Printer Configuration Tool, go to the System menu on the top panel and select Administration, Printing or execute the command system-config-printer.
printer path
If no printers are available for the system, only the Server Settings view is available for selection. If local printers are configured, a Local Printers menu will available.

Install new printer

click New Printer on the toolbar.
new printer
In the dialog window that appears, accept the default queue name or change it to a short, descriptive name that begins with a letter and does not contain spaces. Then select printer from list and click on forward and click on finsh.
spool directories
When your system prints a file, it makes use of special directories called spool directories. The location of the spool directory is obtained from the printer's entry in its configuration file. On Linux, the spool directory is located at /var/spool/cups under a directory with the name of the printer.

print job
A print job is a file to be printed. When you send a file to a printer, a copy of it is made and placed in a spool directory set up for that printer.

classes
CUPS features a way to let you select a group of printers to print a job instead of selecting just one. That way, if one printer is busy or down, another printer can be automatically selected to perform the job. Such groupings of printers are called classes. Once you have installed your printers, you can group them into different classes.

Once you have successfully installed local printer it will show in right pane. and in left pane you can see all administrative options.
printer option
  • To view shared printer on other system Tick mark on first option
  • To share locally attached printer tick mark on second option
  • To allow remote administration of this printer check mark on third option
Tick mark on appropriate option and click on apply
share printer from server

configure window clients

Go on window system and ping from printer server and open internet explorer and give the ip address of server with printer port 631
internet explorer
This will launch CUPS web application click on manage printer
manage printer
now you will see the shared printer on server click on print test page
print test page
A test page will be send on printer server copy this url of printer
copy url
click on start button select printer and fax and click on add new printer. this will launch add new printer wizard click next on welcome screen and select network printer
network printer
On this screen select internet printer and paste the url which you copied from internet explorer
internet printer
Install appropriate driver from list or use have disk option you have drive cd and click next. On next screen set this printer defaults and click on next and finish.
set defaults

Remote administration of print server

Go on linux system and ping from server and click on printing from administration menu
printer path
Now click on go to server
go to printer server
Now give print server ip address
ip address of print server
It will take few minute to connect from server depending on network speed
connecting
Now give root password to connect printer server
root password
you can see all print administrative Manu in right pane Once you have connected with sever
print server options

configure Linux clients

Go on linux system and ping from server and click on printing from administration menu
printer path
Now click on new printer
new printer
Click on forward In the next New Printer screen, select the type of connection to internet printing protocols and in hostname give server ip and printer name in printername
select ipp
select the appropriate model. If multiple drivers are available, select the one most appropriate for your configuration. If you do not want to choose the default and click forward and finish. The main Printer Configuration window should now include the name of your printer.
make default
To print test page click on print test page and a test page will send to print server
print test page

Managing Printers from the Command-Line

The lpadmin command enables you to perform most printer administration tasks from the command-line.
lpadmin

lpc      To view all known queues
lpr      To send print requests to any local print queue
lpq      To see the print queue
lprm     To delete the jobs of your choice use it  with the job number
lp       To print any file.
lpadmin