Linux Prac Print .doc

download Linux Prac Print .doc

of 19

Transcript of Linux Prac Print .doc

  • 7/27/2019 Linux Prac Print .doc

    1/19

    Configuration of apache web server-Server side-

    [root@tyit Desktop]# rpm -q httpdhttpd-2.2.15-5.el6.i686

    [root@tyit Desktop]# cd /var/www/html[root@tyit html]# vim index.html[root@tyit html]# vim /etc.httpd/conf/httpd.conf

    # ServerAdmin [email protected]

    DocumentRoot /var/www/htmlServerName tyit.com

    # ErrorLog logs/dummy-host.example.com-error_log# CustomLog logs/dummy-host.example.com-access_log common

    [root@tyit html]# service httpd restartStopping httpd: [ OK ]Starting httpd: [ OK ][root@tyit html]#

    Client side -

  • 7/27/2019 Linux Prac Print .doc

    2/19

    Configuration of ftp server- Server side-

    [root@tyit Desktop]# rpm -q vsftpdvsftpd-2.2.2-6.el6.i686

    [root@tyit Desktop]# cd /var/ftp/pub[root@tyit pub]# touch f1 f2[root@tyit pub]# cat > f3this is file 3 content[root@tyit pub]# cd[root@tyit ~]# chmod 775 /var/ftp/pub[root@tyit ~]# vim /etc/vsftpd/vsftpd.conf

    12 anonymous_enable=YES27 anon_upload_enable=YES28 #29 # Uncomment this if you want the anonymous FTP user to beable to create30 # new directories.31 anon_mkdir_write_enable=YES

    [root@tyit ~]# service vsftpd restartShutting down vsftpd: [ OK]Starting vsftpd for vsftpd: [ OK][root@tyit ~]# chkconfig vsftpd on[root@tyit ~]#

    [root@tyit ~]# touch f4[root@tyit ~]# chmod 757 /var/ftp/pub[root@tyit ~]# setenforce 0[root@tyit ~]# ftp 192.168.11.14Connected to 192.168.11.14 (192.168.11.14).220 (vsFTPd 2.2.2)Name (192.168.11.14:root): ftp331 Please specify the password.Password:230 Login successful.Remote system type is UNIX.Using binary mode to transfer files.ftp> cd pub250 Directory successfully changed.ftp> put f4local: f4 remote: f4227 Entering Passive Mode (192,168,11,14,75,216).

  • 7/27/2019 Linux Prac Print .doc

    3/19

  • 7/27/2019 Linux Prac Print .doc

    4/19

    Configuration of nfs server-

    [root@tyit Desktop]# rpm -q nfs-utilsnfs-utils-1.2.2-7.el6.i686[root@tyit Desktop]# mkdir /source[root@tyit Desktop]# vim /source/sourcefile[root@tyit Desktop]# chmod 777 /source[root@tyit Desktop]# ifconfig eth1eth1 Link encap:Ethernet HWaddr 00:0C:29:BA:3A:25

    inet addr:192.168.11.14 Bcast:192.168.11.255Mask:255.255.255.0

    inet6 addr: fe80::20c:29ff:feba:3a25/64 Scope:LinkUP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

    RX packets:1142 errors:0 dropped:0 overruns:0 frame:0TX packets:34 errors:0 dropped:0 overruns:0 carrier:0collisions:0 txqueuelen:1000RX bytes:125224 (122.2 KiB) TX bytes:5342 (5.2 KiB)Interrupt:19 Base address:0x2000

    [root@tyit Desktop]# vim /etc/exports

    /source 192.168.11.0/24(rw,sync)

    [root@tyit Desktop]# service nfs restartShutting down NFS mountd: [ OK]Shutting down NFS daemon: [ OK]Shutting down NFS quotas: [ OK]Shutting down NFS services: [ OK]Starting NFS services: [ OK]Starting NFS quotas: [ OK]Starting NFS daemon: [ OK]Starting NFS mountd: [ OK][root@tyit Desktop]# chkconfig nfs on[root@tyit Desktop]# mkdir /mp2[root@tyit Desktop]# vim /etc/fstab

  • 7/27/2019 Linux Prac Print .doc

    5/19

    tmpfs /dev/shm tmpfs defaults0 0devpts /dev/pts devptsgid=5,mode=620 0 0sysfs /sys sysfs defaults

    0 0proc /proc proc defaults0 0192.168.11.14:/source /mp2 nfs defaults 0 0

    [root@tyit Desktop]# mount -a[root@tyit Desktop]# cd /mp2[root@tyit mp2]# lssourcefile[root@tyit mp2]# cat sourcefilemy name is pravesh shukla[root@tyit mp2]#

  • 7/27/2019 Linux Prac Print .doc

    6/19

    Configuaration of samba server -[root@tyit ~]# rpm -q sambasamba-3.5.4-68.el6.i686[root@tyit ~]# mkdir /dirsamba

    [root@tyit ~]# vim /dirsamba/f1[root@tyit ~]# chmod 777 /dirsamba

    [root@tyit ~]# vim /etc/samba/smb.conf

    workgroup = RRAAHHUULLserver string = Samba Server Version %v

    netbios name = samba server

    [share]path = /dirsambareadable = yeswritable = yesbrowseable = yeshosts allow = 192.168.1.0/24

    [root@tyit ~]# service smb restartShutting down SMB services:[FAILED]Starting SMB services: [ OK][root@tyit ~]# chkconfig smb on[root@tyit ~]# setenforce 0[root@tyit ~]# useradd u7[root@tyit ~]# smbpasswd -a u7New SMB password:Retype new SMB password:Added user u7.[root@tyit ~]# smbclient //192.168.1.50/share -U u7Enter u7's password:Domain=[RRAAHHUULL] OS=[Unix] Server=[Samba 3.5.4-68.el6]smb: \> ls

    . D 0 Tue Sep 2416:14:07 2013

    .. DR 0 Tue Sep 2416:13:31 2013

    f1 28 Tue Sep 2416:14:07 2013

    39371 blocks of size 262144. 12241 blocks availablesmb: \>

  • 7/27/2019 Linux Prac Print .doc

    7/19

    configuration of proxy server(squid)-

    server side-

    [root@tyit Desktop]# rpm -q squidsquid-3.1.4-1.el6.i686[root@tyit Desktop]# ifconfig eth1eth1 Link encap:Ethernet HWaddr 00:0C:29:BA:3A:25

    inet addr:192.168.11.14 Bcast:192.168.11.255Mask:255.255.255.0

    inet6 addr: fe80::20c:29ff:feba:3a25/64 Scope:LinkUP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1RX packets:24623 errors:0 dropped:0 overruns:0 frame:0TX packets:48 errors:0 dropped:0 overruns:0 carrier:0collisions:0 txqueuelen:1000

    RX bytes:2276714 (2.1 MiB) TX bytes:7649 (7.4 KiB)Interrupt:19 Base address:0x2000

    [root@tyit Desktop]# vim /etc/squid/squid.confuncomment lines

    5 acl localhost src 192.168.11.0/2457 http_access allow all64 http_port 3128

    [root@tyit Desktop]# service squid restart

    Stopping squid: ................ [ OK ]Starting squid: . [ OK ][root@tyit Desktop]#

  • 7/27/2019 Linux Prac Print .doc

    8/19

    Client side-

    Click on edit menu and select preferences

  • 7/27/2019 Linux Prac Print .doc

    9/19

    Firewall and secutrity configuration-

    [root@localhost Desktop]# ifconfig eth0eth0 Link encap:Ethernet HWaddr 00:0C:29:D7:8E:BD

    inet addr:192.168.73.81 Bcast:192.168.73.255

    Mask:255.255.255.0inet6 addr: fe80::20c:29ff:fed7:8ebd/64 Scope:LinkUP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1RX packets:280 errors:0 dropped:0 overruns:0 frame:0TX packets:28 errors:0 dropped:0 overruns:0 carrier:0collisions:0 txqueuelen:1000RX bytes:26847 (26.2 KiB) TX bytes:4765 (4.6 KiB)Interrupt:19 Base address:0x2000

    [root@localhost Desktop]# ping 192.168.73.81PING 192.168.73.81 (192.168.73.81) 56(84) bytes of data.64 bytes from 192.168.73.81: icmp_seq=1 ttl=64 time=0.078 ms64 bytes from 192.168.73.81: icmp_seq=2 ttl=64 time=0.039 ms64 bytes from 192.168.73.81: icmp_seq=3 ttl=64 time=0.048 ms64 bytes from 192.168.73.81: icmp_seq=4 ttl=64 time=0.527 ms64 bytes from 192.168.73.81: icmp_seq=5 ttl=64 time=0.075 ms^C--- 192.168.73.81 ping statistics ---5 packets transmitted, 5 received, 0% packet loss, time 4209msrtt min/avg/max/mdev = 0.039/0.153/0.527/0.187 ms[root@localhost Desktop]# ftp 192.168.73.81bash: ftp: command not found[root@localhost Desktop]# cd /Packages/[root@localhost Packages]# rpm -ivh ftp*warning: ftp-0.17-51.1.el6.i686.rpm: Header V3 RSA/SHA256Signature, key ID fd431d51: NOKEYPreparing...########################################### [100%]

    1:ftp########################################### [100%]

    [root@localhost ~]# ftp 192.168.73.81Connected to 192.168.73.81 (192.168.73.81).220 (vsFTPd 2.2.2)

    Name (192.168.73.81:root): ftp331 Please specify the password.Password:230 Login successful.Remote system type is UNIX.Using binary mode to transfer files.ftp> cd pub250 Directory successfully changed.

  • 7/27/2019 Linux Prac Print .doc

    10/19

    ftp> bye221 Goodbye.[root@localhost ~]# iptables -I INPUT -s 192.168.73.81 -d192.168.73.81 -j REJECT[root@localhost ~]# ftp 192.168.73.81

    ftp: connect: Connection timed outftp> bye[root@localhost ~]# ping 192.168.73.81PING 192.168.73.81 (192.168.73.81) 56(84) bytes of data.^C--- 192.168.73.81 ping statistics ---8 packets transmitted, 0 received, 100% packet loss, time 7966ms

    [root@localhost ~]# iptables -F[root@localhost ~]# iptables -LChain INPUT (policy ACCEPT)target prot opt source destination

    Chain FORWARD (policy ACCEPT)target prot opt source destination

    Chain OUTPUT (policy ACCEPT)target prot opt source destination[root@localhost ~]# iptables -I INPUT -p tcp --dport 20 -s192.168.73.81 -d 192.168.73.81 -j REJECT[root@localhost ~]# ping 192.168.73.81PING 192.168.73.81 (192.168.73.81) 56(84) bytes of data.64 bytes from 192.168.73.81: icmp_seq=1 ttl=64 time=0.103 ms64 bytes from 192.168.73.81: icmp_seq=2 ttl=64 time=0.062 ms64 bytes from 192.168.73.81: icmp_seq=3 ttl=64 time=0.079 ms64 bytes from 192.168.73.81: icmp_seq=4 ttl=64 time=0.077 ms^C--- 192.168.73.81 ping statistics ---4 packets transmitted, 4 received, 0% packet loss, time 3449msrtt min/avg/max/mdev = 0.062/0.080/0.103/0.016 ms[root@localhost ~]# ftp 192.168.73.81Connected to 192.168.73.81 (192.168.73.81).220 (vsFTPd 2.2.2)Name (192.168.73.81:root): ftp

    331 Please specify the password.Password:230 Login successful.Remote system type is UNIX.Using binary mode to transfer files.ftp> bye221 Goodbye.

  • 7/27/2019 Linux Prac Print .doc

    11/19

    [root@localhost ~]# iptables -I INPUT -p tcp --dport ftp -s192.168.73.81 -d 192.168.73.81 -j REJECT[root@localhost ~]# ftp 192.168.73.81ftp: connect: Connection refusedftp> bye

    [root@localhost ~]# ssh 192.168.73.81The authenticity of host '192.168.73.81 (192.168.73.81)' can'tbe established.RSA key fingerprint is63:4c:83:48:ae:e9:b0:b2:8c:0d:f5:f8:8a:2a:94:ea.Are you sure you want to continue connecting (yes/no)? yesWarning: Permanently added '192.168.73.81' (RSA) to the list ofknown [email protected]'s password:Permission denied, please try [email protected]'s password:[root@localhost ~]# logoutConnection to 192.168.73.81 closed.[root@localhost ~]# iptables -A INPUT -p tcp --dport ssh -s192.168.73.81 -d 192.168.73.81 -j REJECT[root@localhost ~]# ssh 192.168.73.81ssh: connect to host 192.168.73.81 port 22: Connection refused[root@localhost ~]# iptables -LChain INPUT (policy ACCEPT)target prot opt source destinationREJECT tcp -- 192.168.73.81 192.168.73.81 tcpdpt:ssh reject-with icmp-port-unreachableChain FORWARD (policy ACCEPT)target prot opt source destinationChain OUTPUT (policy ACCEPT)target prot opt source destination[root@localhost ~]# sestatusSELinux status: enabledSELinuxfs mount: /selinuxCurrent mode: enforcingMode from config file: enforcingPolicy version: 24Policy from config file: targeted[root@localhost ~]# getenforce

    Enforcing[root@localhost ~]# setenforce 0[root@localhost ~]# getenforcePermissive[root@localhost ~]# lokkit --disabled[root@localhost ~]# lokkit --enabled[root@localhost ~]# lokkit --disabled[root@localhost ~]# lokkit --selinux=enforcing

  • 7/27/2019 Linux Prac Print .doc

    12/19

    Installation of packages-

    [root@harshali ~]# rpm --versionRPM version 4.4.2[root@harshali ~]# rpm --test -e squid

    [root@harshali ~]# rpm -q --requires squid/bin/bash/bin/sh/bin/sh/bin/sh/bin/sh/bin/sh/bin/sh/sbin/chkconfig/usr/bin/perlbash >= 2.0chkconfigconfig(squid) = 7:2.6.STABLE6-3.el5libc.so.6libc.so.6(GLIBC_2.0)libc.so.6(GLIBC_2.1)libc.so.6(GLIBC_2.2)libc.so.6(GLIBC_2.2.3)libc.so.6(GLIBC_2.3)libc.so.6(GLIBC_2.3.2)libc.so.6(GLIBC_2.3.4)libcrypt.so.1libcrypt.so.1(GLIBC_2.0)libcrypto.so.6libdl.so.2liblber-2.3.so.0libldap-2.3.so.0libm.so.6libm.so.6(GLIBC_2.0)libnsl.so.1libnsl.so.1(GLIBC_2.0)libpam.so.0libpam.so.0(LIBPAM_1.0)libpthread.so.0

    libpthread.so.0(GLIBC_2.0)libpthread.so.0(GLIBC_2.1)libpthread.so.0(GLIBC_2.2)libpthread.so.0(GLIBC_2.3.2)librt.so.1libsasl2.so.2libssl.so.6libz.so.1

  • 7/27/2019 Linux Prac Print .doc

    13/19

    logrotateperl >= 0:5.003perl(File::Basename)perl(Getopt::Std)perl(URI::URL)

    perl(getopts.pl)perl(strict)perl(vars)rpmlib(CompressedFileNames)

  • 7/27/2019 Linux Prac Print .doc

    14/19

    [root@harshali ~]# chmod 770 /etc/exports[root@harshali ~]# useradd u1[root@harshali ~]# chown u1 /etc/exports[root@harshali ~]# chgrp u1 /etc/exports[root@harshali ~]# rpm -V nfs-utils

    [root@harshali ~]# vim /etc/vsftpd/vsftpd.conf[root@harshali ~]# chown u1 /etc/vsftpd/vsftpd.conf[root@harshali ~]# chgrp u1 /etc/vsftpd/vsftpd.conf[root@harshali ~]# rpm -V vsftpd.....UGT c /etc/vsftpd/vsftpd.conf[root@harshali ~]#

  • 7/27/2019 Linux Prac Print .doc

    15/19

    Configuration of TCP/IP-

    [root@tyit Desktop]# setup

  • 7/27/2019 Linux Prac Print .doc

    16/19

  • 7/27/2019 Linux Prac Print .doc

    17/19

    [root@tyit Desktop]# service network restart*******************************output************************************Shutting down interface eth0: [ OK]

    Shutting down loopback interface: [ OK]Bringing up loopback interface: [ OK]

    [root@tyit Desktop]#vim /etc/sysconfig/network-scripts/ifcfg-eth0

  • 7/27/2019 Linux Prac Print .doc

    18/19

    [root@tyit Desktop]#vim /etc/sysconfig/network

    [root@tyit Desktop]#system-config-network

  • 7/27/2019 Linux Prac Print .doc

    19/19

    [root@tyit Desktop]# ifconfig eth0 198.162.11.10 netmask255.255.255.0 broadcast 198.162.11.255[root@tyit Desktop]# ifconfig eth0

    *******************************output************************************eth0 Link encap:Ethernet HWaddr 00:0C:29:E6:F6:0F

    inet addr:198.162.11.10 Bcast:198.162.11.255Mask:255.255.255.0

    inet6 addr: fe80::20c:29ff:fee6:f60f/64 Scope:LinkUP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1RX packets:1363 errors:0 dropped:0 overruns:0 frame:0TX packets:37 errors:0 dropped:0 overruns:0 carrier:0collisions:0 txqueuelen:1000RX bytes:117748 (114.9 KiB) TX bytes:5775 (5.6 KiB)Interrupt:19 Base address:0x2000

    ****************************************************************