Thursday, 4 November 2021

Configuring samba standalone server

 

Configuring samba standalone server

To share files from linux to windows machine samba is used. Below lets see how to install and configure samba to share files from linux to windows. 

Step 1: Check if samba package is installed, using the following command.

# rpm –qa samba*

Step 2: If samba is not installed then install samba using following command.

# yum install samba

Step 3: Create a Directory you want to share.

# mkdir directory_name

Step 4: Grant the directory full permission.

# chmod 777 directory_name

Step 5: Now create a share user.

# useradd directory_name

Step 6: Create password for the user.

# passwd username

Step 7: Now to share the directory edit the smb.conf file using following command.

# vi /etc/samba/smb.conf

Step 8: Change the workgroup to your workgroup.

Add the following lines in the end of this file /etc/samba/smb.conf

Save this file and exit using Esc :wq

Step 9: check the firewall status, if it is on turn off the firewall.

# service iptables status

Step 10: Turn off firewall.

# service iptables stop

Even after turning off the firewall while rebooting it starts so to permanently turn it off.

# chkconfig iptables off

 Check the firewall status again.

# service iptables status

Step 11: Turn off Selinux

# vi /etc/sysconfig/selinux



Change selinux to disabled if it is in enforcing. Save and quit using Esc :wq

Step 12: Now start samba service.

# service smb start


This starts the samba service but when you restart it turns off to turn it on

# chkconfig smb on


To check the status of samba service

# service smb status

Step 13: Create sharing users password

# smbpasswd -a sharing

Step 14: Reboot your computer and open windows computer and access the shared folder with this password and the username for which you have created the smbpasswd, here it is Sharing(username).

To change permissions for shared folders.

Restricting shared folder to one user alone.

Create a new user you want to allow permission for writing the shared folder.

Edit the smb.conf  file and change the value for writable as no in the folder which you want to restrict, and change the value of write list to the user name which you want to allow permission. Here the user name is Sharing.


Share restricted for all user except for user(Sharing).

Wednesday, 3 November 2021

Dual boot windows 7 & Ubuntu using windows installer

 

Dual boot windows 7 & Ubuntu using windows installer

 Prerequisites

1.       Windows 7 installed.
2.       Ubuntu 12.04 iso and wubi.exe file to be copied on the windows 7 machine.

Installation steps

     èDownload the windows installer wubi.exe file from http://www.ubuntu.com/download/desktop/windows-installer

     èCopy the wubi.exe file and the iso file in same directory



èNow run the wubi.exe windows installer file, you will require administrative rights to do this, you wil get a dialog box as shown below,


èSelect the installation drive where you want to store the installation files of Ubuntu,

 
èSelect the installation size for the Ubuntu a minimum of 5GB and maximum of 30GB will be available based on the space available on your disk selected,

 

èSelect the desktop environment here it is ubuntu, give the password for the username which you will be using to logon into ubuntu.

           è Now click Install and the installation procedure will start with the following screen

èAfter the installation files copied to the drive setup will ask for reboot, select reboot and click finish.



èNow the system will reboot and start the Ubuntu installation



èAfter installation is completed, and after rebooting your system  is ready with dual booting select the required os and you can work with it.

èSelecting Ubuntu will show the following screen select the first and Ubuntu will be loaded



èThe partition in ubuntu shows as below,

 

Sunday, 24 October 2021

Basic Linux commands

Basic Linux commands and its uses


Following are the basic linux commands, getting familiar with below commands will help beginner in linux administration.

Each command has a extensive manual page for it. We can review the man page using syntax as below, 

#man <command_name>


ssh - connect to another server over network
syntax: ssh server_name

ls - list files and directories.
syntax: ls

pwd - print present working directory 
syntax: pwd

cat - read contents of file without editing the file
syntax: cat file_name

vi - view/edit contents of a file.
syntax: vi file_name

rm - remove / delete a file 
syntax: rm file_name

rmdir - remove / delete directory and its contents
syntax: rmdir directory_name

cp - copy a file from one location to another 
syntax: cp source_file destination_path

cd - change directory to given path
syntax: cd destination_path

grep - find a particular pattern in given file
syntax: grep test filename.txt

yum - Install / remove /update packages/softwares.
syntax: yum install package_name
            yum remove package_name
            yum update package name

Wednesday, 20 October 2021

Squid proxy


Step 1: Install squid using following command.

[root@MailZim ~]# yum install squid

Step 2: Now configure the network of the windows machine in which you want to control the internet using this proxy as shown below.

Step 2.1: Open run command and type inetcpl.cpl

 







Step 2.2: In internet properties select connections tab and select Lan settings.









Step 2.3: Select use a proxy server for your LAN as shown below and type your proxy server ip address here it is 192.168.1.63 and default port is 3128.









Step 3: open Ip properties and remove the dns and gateway. As shown below,









Now check opening google on any of your browser, if it opens then proxy is working perfectly, else check the above steps properly.

Step 4: Add the following highlighted lines in the squid.conf file using following command.

[root@MailZim ~]# vi /etc/squid/squid.conf








Save and exit using Esc :wq

Step 5: Now create a new file using which you are going to block a group of websites, for which  the path is as said in the above highlighted lines, here it is




Step 6: Add the sites which you want to block as shown below, starting with . no www is needed, save and exit after edititing.






Step 7: Now reload the squid proxy service, using the following command,



Step 8: To block sites separately without using any file add the following lines in squid.conf file, as shown below,

acl google dstdomain .google.com

http_access deny google








Step 9 : reload the squid service.

 

 

DONE !!! blocked using proxy squid.


Wednesday, 11 August 2021

Extend Logical volume using LVM

 Extend Logical volume using LVM


I am going to extend already created xfs file system using LVM by 1GB.
Currently i have no free space in pv / vg / lv to extend it to the File system.
So i will be adding a new 1 GB disk to the VM first and then extend vg / lv.
Adding disk and making partition is explained here.

Let's continue with our work to extend pv first. 
Current pv vg and lv output as below. and you can see i have no space for now. 

1.1 Current Physical volume

1.2 Current Physical volume free space detail

1.3 Current VG details

1.4 Current LV details

I have completed adding disk and got it on the server by scanning the scsi hosts.
Lets proceed creating a new pv using the newly added disk. 
Command to create pv - pvcreate 
Syntax : pvcreate disk_name
disk_name = /dev/sdc1

1.5 pv create

Now we can extend our vg vgdata with the newly created pv as shown below,
Syntax: vgextend vgname pvname
vgname = vgdata
pvname = /dev/sdc1

1.6 vg extend



1.7 new vg details


1.7 current lv details

Now we have free space in vg, we can extend the lv,
Syntax : lvextend -L +size lvname
size = 1020MiB 
lvname = /dev/vgdata/lvdata

1.8 extend lv

You can see the newly extended size in lvs and lvdisplay command as below

1.9 new lv

LV size is extended, however this will not be visible to file system yet. we have to resize / grow the file system. I have a xfs file system so i will use xfs_growfs, if you have a older fs like ext4/3/2 you may use resize2fs.

command: xfs_growfs
Syntax : xfs_grow lvname/devicename
lvname = /dev/mapper/vgdata-lvdata

1.10 xfs grow

Once you have executed xfs_growfs for the file system you can now see the increased size in the df -h output and you can start utilizing the newly available fs. 

1.11 Extended xfs filesystem


This is the best advantage of a LVM, you can grow/extend/increase your file system space online without any need for downtime. 
LVM has many more uses like cluster support, raid features, backup/recovery.