Thursday 3 November 2011

Configuration of FTP Server in LINUX

Ftp server is designed for uploading and downloading the files, when ftp server users log's in, they get their home folder at client side and if public/anonymous user log's in they get data stored in /var/ftp folder

Steps to Configure FTP Server in LINUX

Step:--1.  Check and install required Packages

Check the packages are installed or not by rpm/yum command

[root@server ~]# rpm -q vsftpd

Remove the packages and old data if required

[root@server ~]# yum remove vsftpd* -y

Install the Packages

Note: Here my file is at Desktop. So i was changing the path to Desktop.

[root@server ~]# cd /root/Desktop/
[root@server Desktop]# ls

FileZilla3  tomcat  vsftpd-2.0.5-10.el5.i386.rpm

[root@server Desktop]# chmod 777 vsftpd-2.0.5-10.el5.i386.rpm

[root@server Desktop]# rpm -ivh vsftpd-2.0.5-10.el5.i386.rpm
warning: vsftpd-2.0.5-10.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...                ########################################### [100%]
   1:vsftpd                 ########################################### [100%]

Step:--2. Create the resources on ftp server (file/folder & Users)

   Create users and assign passwords to whom you want to allow logging through ftp
  
   [root@server ~]# useradd tom
   [root@server ~]# useradd joy
   [root@server ~]# passwd tom
   Changing password for user tom.
   New UNIX password:
   BAD PASSWORD: it is too simplistic/systematic
   Retype new UNIX password:
   passwd: all authentication tokens updated successfully.
   [root@server ~]# passwd joy
   Changing password for user joy.
   New UNIX password:
   BAD PASSWORD: it is too simplistic/systematic
   Retype new UNIX password:
   passwd: all authentication tokens updated successfully.
   [root@server ~]#

Create or Copy some files inside /var/ftp/pub folder

[root@server ~]# cd /var/ftp/pub/
[root@server pub]# touch fa.txt fb.txt music.mp3
[root@server pub]# ls
fa.txt  fb.txt  music.mp3


Create a Upload folder for anonymous users and give full permission for read/write.

For example LINUX N UNIX HELP UPLOADS

[root@server pub]# mkdir /var/ftp/linux n unix help uploads
[root@server pub]# chmod 777 /var/ftp/linux n unix help uploads
[root@server pub]#


Step:--3. Edit the Main Configuration file /etc/vsftpd/vsftpd.conf

[root@server ~]# vi /etc/vsftpd/vsftpd.conf

  12 anonymous_enable=YES
 
  15 local_enable=YES

  27 anon_upload_enable=YES

  83 ftpd_banner=Welcome to LINUX N UNIX HELP

 
  :wq!
 
 
Step:--  4. To block the ftp server users (for Ex:-- joy) write the user name in file
 
  /etc/vsftpd/ftpusers
 
  [root@server ~]# vi /etc/vsftpd/ftpusers


# Users that are not allowed to login via ftp
root
bin
daemon
adm
lp
sync
shutdown
halt
mail
news
uucp
operator
games
nobody
joy
~
~
~
~
~
~
~
:wq!


Step:--5. start th ftp service


[root@server ~]# vi /etc/vsftpd/ftpusers
[root@server ~]# service vsftpd restart
Shutting down vsftpd:                                      [FAILED]
Starting vsftpd for vsftpd:                                [  OK  ]
[root@server ~]# service vsftpd restart
Shutting down vsftpd:                                      [  OK  ]
Starting vsftpd for vsftpd:                                [  OK  ]
[root@server ~]#



Note:--- Your system Firewall should be turnoff or In firewall settings ftp exception should be added.

For Checking your ftp in Client Machine, Do the following steps:

1.Open the Web Browser and give following URL

ftp://192.168.10.121/

Here replace your ftp server IP address.

To upload or Any changes use any Ftp Software like Winscp or Filzilla , etc....


Wednesday 2 November 2011

Network Configurations in Linux

Assigning a static IP address --- temporarily

Syntax:--

[root@server ~]# ifconfig <devicename> <IP address>

Example:-- To Assign the static IP address as 192.168.10.121

[root@server ~]# ifconfig eth0 192.168.10.121

To check the IP assigned

[root@server ~]# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:08:02:F7:33:6A
          inet addr:192.168.10.121  Bcast:192.168.10.255  Mask:255.255.255.0
          inet6 addr: fe80::208:2ff:fef7:336a/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:773 errors:0 dropped:0 overruns:0 frame:0
          TX packets:137 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:77098 (75.2 KiB)  TX bytes:23592 (23.0 KiB)
          Interrupt:177

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:1670 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1670 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:3349244 (3.1 MiB)  TX bytes:3349244 (3.1 MiB)

Set Permanent IP address

Do the following Steps:

1. Go to the following Path

    [root@server ~]# cd /etc/sysconfig/network-scripts/

2. After that edit the following file

   [root@server network-scripts]# vi ifcfg-eth0
  
# Broadcom Corporation NetXtreme BCM5702X Gigabit Ethernet
DEVICE=eth0
HWADDR=00:08:02:f7:33:6a
ONBOOT=yes
NETMASK=255.255.255.0
IPADDR=192.168.10.121
GATEWAY=192.168.10.254
TYPE=Ethernet
~
~
:wq!

3. After this restart the network service to activate the new IP address.

To see the LAN card i.e NIC card Parameters


[root@server ~]# ethtool eth0
Settings for eth0:
        Supported ports: [ MII ]
        Supported link modes:   10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Half 1000baseT/Full
        Supports auto-negotiation: Yes
        Advertised link modes:  10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Half 1000baseT/Full
        Advertised auto-negotiation: Yes
        Speed: 100Mb/s
        Duplex: Full
        Port: Twisted Pair
        PHYAD: 1
        Transceiver: internal
        Auto-negotiation: on
        Supports Wake-on: g
        Wake-on: d
        Current message level: 0x000000ff (255)
        Link detected: yes

To enable IP address

[root@server ~]# ifup eth0

To disable IP address

[root@server ~]# ifdown eth0


This is a file where IP address are stored.

[root@server ~]# cd /etc/sysconfig/network-scripts/
[root@server network-scripts]# cat ifcfg-eth0
# Broadcom Corporation NetXtreme BCM5702X Gigabit Ethernet
DEVICE=eth0
HWADDR=00:08:02:f7:33:6a
ONBOOT=yes
NETMASK=255.255.255.0
IPADDR=192.168.10.121
GATEWAY=192.168.10.254
TYPE=Ethernet

Tuesday 1 November 2011

Networking in LINUX

Introduction to Networking in Linux

To check the system hostname

[root@localhost ~]# hostname
localhost.localdomain

Assigning the hostname - temporarly

Syntax:-

[root@localhost ~]# hostname <computer>

EX:- To assign the hostname as server.linuxnunixhelp.com

[root@localhost ~]# hostname server.linuxnunixhelp.com

To check the hostname assigned

[root@localhost ~]# hostname
server.linuxnunixhelp.com

Assigning hostname ---- Permanently

Edit the configuration file /etc/sysconfig/network

NETWORKING=yes
HOSTNAME=server.linuxnunixhelp.com




:wq!

System Process Commands in Linux

TO check the Process id of any application, command etc

[root@localhost ~]# ps -aux

To kill a process normally


[root@localhost ~]# kill <process_id>

ex: -- [root@localhost ~]# kill 2521

To kill the process forcefully use stamp value as '9'
[root@localhost ~]# kill -9 <process_id>

[root@localhost ~]# kill -9 2521

To see the cpu & process status
[root@localhost ~]# top

To see the open port number and service name

[root@localhost ~]# netstat -antp
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name
tcp        0      0 127.0.0.1:2208              0.0.0.0:*                   LISTEN      1802/hpiod
tcp        0      0 0.0.0.0:969                 0.0.0.0:*                   LISTEN      1635/rpc.statd
tcp        0      0 0.0.0.0:111                 0.0.0.0:*                   LISTEN      1606/portmap
tcp        0      0 127.0.0.1:631               0.0.0.0:*                   LISTEN      1819/cupsd
tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN      1854/sendmail: acce
tcp        0      0 127.0.0.1:2207              0.0.0.0:*                   LISTEN      1807/python
tcp        0      0 :::22                       :::*                        LISTEN      1833/sshd
tcp        0    148 ::ffff:192.168.10.120:22    ::ffff:192.168.10.114:1401  ESTABLISHED 2411/1


To view how long the system is running

[root@localhost ~]# uptime
 23:34:45 up 23 min,  2 users,  load average: 0.00, 0.02, 0.08

To view Process, Resource and File Systems

[root@localhost ~]# gnome-system-monitor &


To dump the traffic on the network

[root@localhost ~]# tcpdump -i eth0


To display or change Ethernet card settings
[root@localhost ~]# ethtool eth0
Settings for eth0:
        Supported ports: [ MII ]
        Supported link modes:   10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Half 1000baseT/Full
        Supports auto-negotiation: Yes
        Advertised link modes:  10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Half 1000baseT/Full
        Advertised auto-negotiation: Yes
        Speed: 100Mb/s
        Duplex: Full
        Port: Twisted Pair
        PHYAD: 1

To Recover Root Password in Linux

1. Restart the PC while restarting press any key to get Grub Screen
2. Press 'e'
3. Select kernal /vmlinuz-2.6.18.-8.el5 ro root=LABEL=/ rhgb quiet
4. Again Press 'e' to edit
5. Edit kernal /vmlinuz-2.6.18.-8.el5 ro root=/ rhgb quiet line and erase quite and type single
6. Press enter
7. Press b to boot
8. At shell prompt type the commands

sh-3.00# passwd
Changing Password for user root
New UNIX Password:123456
Retype new UNIX Password: 123456
Passwd: all authentication tokens updated Successfully.

Now type the following command to Restart the system to the normal Login

sh-3.00# init 6

Usage of chkconfig command

To view the status of the the services in all runlevels
 

[root@localhost ~]# chkconfig --list

To view the status of the Particular services.
For example Bluetooth



[root@localhost ~]# chkconfig --list bluetooth
bluetooth       0:off   1:off   2:off   3:off   4:off   5:off   6:off

To put the service at all runlevel as on

[root@localhost ~]# chkconfig bluetooth on

To view the status

[root@localhost ~]# chkconfig --list bluetooth
bluetooth       0:off   1:off   2:on    3:on    4:on    5:on    6:off

To put the service at all runlevel as off


[root@localhost ~]# chkconfig bluetooth off

To view the status

[root@localhost ~]# chkconfig --list bluetooth
bluetooth       0:off   1:off   2:off   3:off   4:off   5:off   6:off


To manually stop the service

[root@localhost ~]# service bluetooth stop
Stopping Bluetooth services:                               [  OK  ]

To Manually start the service

[root@localhost ~]# service bluetooth start
Starting Bluetooth services:                               [  OK  ]


To Manually restart the service

[root@localhost ~]# service bluetooth restart
Stopping Bluetooth services:                               [  OK  ]
Starting Bluetooth services:                               [  OK  ]


 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Affiliate Network Reviews