- #yum install samba
- #service smb restart
- #chkconfig smb on
- #vim /etc/samba/smb.conf
- Line 57 Ensure foll. is there ---> [global]
- Line 74 Put appropriate group name as required. default is workgroup = MYGROUP
- eg. workgroup = REDHAT
- Last Line : Copy last 7 lines and paste it below that, fill/replace as per question.
- eg share name=song, path=/mp3
- [song]
- comment=my collection
- path=/mp3
- public=yes
- writable=yes
- printable=no
- write list=+staff ---->group name
- Then add following so that people can browse it
- browseable=yes
- #service smb restart
- #mkdir /mp3
- Then run following on the client side to verify which share name is available against given IP/hostname
- #smbclient -L <IP address>
- Check the context of the file to be shared
- #ls -ldZ /mp3 ----> default context is default_t
- Change context of the file to be shared
- #chcon -t samba_share_t /mp3
- We can verify it
- in the file /etc/samba/smb.conf ---> Line 40
- #smbclient //localhost/song -U ---> U is for anonymous user
- If not sharing with public user [#vim /etc/samba/smb.conf]
- Remove, public=yes
- Or put, public=no
- valid user = u1, u2, u3
- host allow = 192.168.0.
- save & quit
- Now create samba user
- #useradd -s /sbin/nologin u1
- #useradd -s /sbin/nologin u2
- #useradd -s /sbin/nologin u3
- Assign samba password to user u1, u2, u3
- #smbpasswd -a u1
- #smbpasswd -a u2
- #smbpasswd -a u3
- #service smb restart
- #smbclient -L localhost
- #smbclient //localhost/song -U u1
- Verification
- Now mount it (o=lowercase alphabet o)
- #mount -t cifs -o user=u1 localhost:/ /mnt ----> It will ask password for user u1
- #mount -t cifs -o user=u1%123 localhost:/song /mnt ----> Password for user u1 is mentioned as 123
- #df -h
Thursday, 5 September 2013
Configuring Samba
Wednesday, 4 September 2013
Configuring SMTP (POSTFIX)
- #yum install postfix
- #service postfix restart
- #chkconfig postfix on
- #vim /etc/postfix/main.cf
- Line 83 --> Uncomment & put domain name
- mydomain=example.com
- Line 99 --> Uncomment & put domain name
- myorigin=example.com
- Line 113 --> Uncomment
- inet_interfaces=all
- Line 116 --> Comment it
- #inet_interfaces=localhost
- Line 164 --> Comment it
- #mydestination=$myhostname,localhost,$mydomain,localhost
- Line 165 --> Uncomment
- mydestination=$myhostname,localhost.$mydomain,localhost,$mydomain
- #service postfix restart
- Forward the mail from hr@example.com to employee@example.com
- #vim /etc/postfix/virtual
- Go to last line (shift+g) and append following:
- hr@example.com employee@example.com
- Copy Line 158-159 of /etc/postfix/virtual & Paste in the end of /etc/postfix/virtual and Uncomment it
- #vim /etc/postfix/virtual
- #postmap /etc/postfix/main.cf
- Create alias for hr for employee, like any mail coming to hr@example.com should be delivered to employee@example.com as well
- #vim /etc/aliases
- Go to last line, append following
- hr : employee
Configuring FTP (Download/Upload)
- Anonymous Download
- #yum install vsftpd
- #service vsftpd restart
- #chkconfig vsftpd on
- Local User Download
- #getsebool -a | grep ftp
- #setsebool -P ftp_home_dir on
- #yum install ftp
- #ftp localhost/<IP>
- Upload
- #vim /etc/vsftpd/vsftpd.conf
- Line 27, --> Uncomment
- anon_upload_enable=yes
- #mkdir /var/ftp/upload
- #chmod g+w /var/ftp/upload
- #chgrp ftp /var/ftp/upload
- Check the content,
- #ls -ldZ /var/ftp/upload ---> public_content_t
- Change the content
- #chcon -t public_content_rw_t /var/ftp/upload
- Change the boolean
- #getsebool -a | grep ftp
- #setsebool -P allow_ftpd_anon_write on
- #service vsftpd restart
- Verification
- #cd /root
- #ftp localhost/<IP>
- #ls ---> pub & upload
- #cd upload
- #mput install.log
- Iptable Rules
- Clients outside example.com should not have access to your FTP service (IP & subnet will be given)
- #iptables -I INPUT ! -s example.com -p tcp --dport 21 -j REJECT
Export a directory via NFS
- Create a directory eg. /comon
- #mkdir /common
- Install package
- #yum install nfs-utils
- Change Mode(chmod) of the directory
- #chmod 777 /common
- Make entry in the /etc/exports file
- #vim /etc/exports
- (r,w) access only to 192.168.0.1 Network
- /common 192.168.0.1/255.255.255.0(rw,sync)
- (r) access to all
- /common *(ro,sync)
- give access to root on host 192.168.0.25
- /common 192.168.0.25(rw,no_root_sqash,sync)
- NFS to example.com domain only
- /common *.example.com(rw,sync)
- Save & quit
- Restart nfs
- #service nfs restart
- #chkconfig nfs on
- To verify,
- Virtual M/c #showmount -e localhost
Tuesday, 3 September 2013
Configuring SSH
1: Search if the package is laready installed.
#rpm -qa | grep ssh
2: #yum search ssh
3: #yum install openssh-server
4: Make sure you flush iptables before setting any new iptables rule
5: Don't flush your iptables in the middle/end else all your set iptables
#iptables -F
#service iptables save
#service iptables restart
Setting IPTABLE Rules
6: Clients within remote.test should not have SSH access to your system
#iptables -I INPUT -s <remote.test n/w address> -p tcp --dport 22 j REJECT
7: Only 192.168.0.1/255.255.255.0 should have SSH access
#iptables -I INPUT ! -s 192.168.0.1/255.255.255.0 -p tcp --dport 22 -j REJECT
8: 192.168.0.1/255.255.255.0 should have SSH access
#iptables -I INPUT -s 192.168.0.1/255.255.255.0 -p tcp --dport 22 -j ACCEPT
#rpm -qa | grep ssh
2: #yum search ssh
3: #yum install openssh-server
4: Make sure you flush iptables before setting any new iptables rule
5: Don't flush your iptables in the middle/end else all your set iptables
#iptables -F
#service iptables save
#service iptables restart
Setting IPTABLE Rules
6: Clients within remote.test should not have SSH access to your system
#iptables -I INPUT -s <remote.test n/w address> -p tcp --dport 22 j REJECT
7: Only 192.168.0.1/255.255.255.0 should have SSH access
#iptables -I INPUT ! -s 192.168.0.1/255.255.255.0 -p tcp --dport 22 -j REJECT
8: 192.168.0.1/255.255.255.0 should have SSH access
#iptables -I INPUT -s 192.168.0.1/255.255.255.0 -p tcp --dport 22 -j ACCEPT
Automounting of iso file/CD-ROM
1: Download the .iso file
#wget <file_name>
2: Mount Point should be given
3: Make /etc/fstab entry
#vim /etc/fstab
/root/image.iso /mnt iso9660 loop,ro 0 0
4: save & quit
5: #mount -a
#wget <file_name>
2: Mount Point should be given
3: Make /etc/fstab entry
#vim /etc/fstab
/root/image.iso /mnt iso9660 loop,ro 0 0
4: save & quit
5: #mount -a
Subscribe to:
Posts (Atom)