Share This
//Setting Up Samba File Server for Sharing

Setting Up Samba File Server for Sharing

Windows File Server Structure

– Set up a Linux server as a File Server for Windows

– Install Samba here, set it up to allow access to the Home Directory of Users from Windows

– Additionally, create a Sharing Folder that all Users can access

– Configure Samba server access within the internal network system

Install Samba
[root@centos ~]# yum -y install samba

Configure Samba

1) Case of creating a new User

→ Register a new User on Linux
[root@centos ~]# useradd centos

→ Set password
[root@centos ~]# passwd centos

Changing password for user centos.

New password:

Retype new password:

password: all authentication tokens updated successfully.

2) Case of using an existing user to access the Samba server, proceed as follows

→ Use the registered User in Linux as the Samba access user in the new registration form (example: centos)
[root@centos ~]# pdbedit -a centos

new password:

retype new password:
startsmbfilepwent_internal: file /etc/samba/smbpasswd did not exist. File successfully created.

Unix username: centos

NT username:

Account Flags: [U ]

User SID: S-1-5-21-1397570601-503051572-2212552623-2000

Primary Group SID: S-1-5-21-1397570601-503051572-2212552623-2001

Full Name:

Home Directory: \\linux\centos

HomeDir Drive:

Logon Script:

Profile Path: \\linux\centos\profile

Domain: LINUX

Account desc:

Workstations:

Munged dial:

Logon time: 0

Logoff time: Sat, 14 Dec 1901 05:45:51 GMT

Kickoff time: Sat, 14 Dec 1901 05:45:51 GMT

Password last set: Mon, 13 Dec 2004 16:06:00 GMT

Password can change: Mon, 13 Dec 2004 16:06:00 GMT

Password must change: Sat, 14 Dec 1901 05:45:51 GMT

Last bad password: 0

Bad password count: 0

Logon hours: FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF

Create Home Directory (This step was not performed by Khôi)

1) Process for newly created User

→ Create Samba Directory when creating a new user
[root@centos ~]# mkdir /etc/skel/samba

2) Process for existing User

→ Create a script to generate a Samba directory for an existing user
[root@centos ~]# vi mkhomedir.sh
#!/bin/bash

for user in $(ls /home)

do

id $user > /dev/null 2>&1

[ $? -eq 0 ] && \

[ ! -d /home/$user/samba ] && \

mkdir /home/$user/samba && \

chown $user:$user /home/$user/samba && \

echo “/home/$user/samba create”

done

→ Execute the script to create Samba directories for existing Users
[root@centos ~]# sh mkhomedir.sh

→ Remove the script that creates Samba directories for existing Users
[root@centos ~]# rm -f mkhomedir.sh

Create Shared Directory

→ Create a shared directory that all Users can access
[root@centos ~]# mkdir /home/samba

→ Change the ownership of the shared directory
[root@centos ~]# chown nobody:nobody /home/samba

※※※※※※※※※※※※※※※

※ In Khôi’s case: ※
※※※※※※※※※※※※※※※

→ Create a Public directory inside Home
[root@vietnam home]# mkdir public

→ Change permissions for the Home directory (full permissions)
[root@vietnam ~]# chmod 777 /home/

→ Grant full permissions for all users to the public directory
[root@vietnam ~]# chmod 777 /home/public/

Configure Samba

→ Modify Samba settings file
[root@centos ~]# vi /etc/samba/smb.conf
[global]

→ Insert (Japanese font code for Linux)
unix charset = UTF-8

→ Insert (Japanese font code for Windows)
dos charset = CP932

→ Insert (Japanese font code for Windows)
display charset = UTF-8

# workgroup = NT-Domain-Name or Workgroup-Name
workgroup = MYGROUP

→ Update (specify the Windows WorkGroup name)
workgroup = WORKGROUP

※Properties of Windows ⇒ Refer to the WorkGroup column in the Computer name tab

→ Insert (Allow internal access)
; hosts allow = 192.168.1. 192.168.2. 127.
hosts allow = 192.168.1. 127.

# If you want to automatically load your printer list rather
# than setting them up individually then you’ll need this

※In case Samba is not sharing a Printer

→ Add a semicolon at the start of the line (to disable printer sharing)
; load printers = yes

→ Insert (Disable Printer Sharing)
load printers = no

→ Insert (Disable Printer Sharing)
disable spoolss = yes

[homes]

comment = Home Directories

→ Insert (/home/UserName as the Home Directory for Samba)
path = %H/samba
browseable = no
writable = yes

3) Add Recycle Bin feature for Users

※Files will automatically be moved to the Recycle Bin when deleted

→ Share Recycle Bin
vfs objects = recycle

→ Recycle Bin Directory Name (/home/UserName/.recycle)
recycle:repository = .recycle

→ Do not retain directory structure when moving to Recycle Bin
recycle:keeptree = no

→ Rename files in case of duplicate names in Recycle Bin
recycle:versions = yes

→ Do not update the timestamp when moved to Recycle Bin
recycle:touch = no

→ Set the file size limit for Recycle Bin (0: no limit)
recycle:maxsize = 0

→ Exclude file types that are deleted immediately without going to Recycle Bin
recycle:exclude = *.tmp ~$*

→ Add the Recycle Bin function for User directories

→ Add the section below at the end

[public]

comment = Public Stuff

path = /home/samba

public = yes

writable = yes

only guest = yes

※Configure the Recycle Bin for file deletions

→ Share Recycle Bin
vfs objects = recycle

→ Recycle Bin Directory Name (/home/UserName/.recycle)

recycle:repository = .recycle

→ Do not retain directory structure when moved to Recycle Bin

recycle:keeptree = no

→ Rename files in case of duplicate names in Recycle Bin

recycle:versions = yes

→ Do not update the timestamp when moved to Recycle Bin

recycle:touch = no

→ Set the file size limit for Recycle Bin (0: no limit)

recycle:maxsize = 0

→ Exclude file types that are deleted immediately without going to Recycle Bin

recycle:exclude = *.tmp ~$*

→ The Recycle Bin feature for Sharing Directory is now completed

※※※※※※※※※※※※※※※

※ In Khôi’s case: ※
※※※※※※※※※※※※※※※

→ Modify Samba settings file
[root@centos ~]# vi /etc/samba/smb.conf

— Line 102 (:102 → use this command to jump to line 102 in the file)

→ Require username and password for access
;security = user

→ Change security so everyone can access without a password
security = share

— There are two Sharing directories: Public and Kuhan, set as follows

[Public]

path = /home/public

writable = yes

guest ok = yes

guest only = yes

create mode = 0777

directory mode = 0777

share modes = yes

[Kuhan]

path = /home/kuhan

writable = yes

guest ok = yes

guest only = yes

create mode = 0777

directory mode = 0777

share modes = yes

Restart Samba

→ Start Samba
[root@centos ~]# /etc/rc.d/init.d/smb start

— Starting SMB service: [ OK ]

→ Start nmb
[root@centos ~]# /etc/rc.d/init.d/nmb start

— Starting NMB service: [ OK ]

→ Set Samba to start automatically
[root@centos ~]# chkconfig smb on

→ Set NMB to start automatically
[root@centos ~]# chkconfig nmb on

— List service status
[root@vietnam ~]# chkconfig –list

nmb 0:off 1:off 2:on 3:on 4:on 5:on 6:off

smb 0:off 1:off 2:on 3:on 4:on 5:on 6:off

★ Reference Links

https://centossrv.com/samba.shtml

https://www.jitaku-server.net/samba_setup.html

https://shikichi.ddo.jp/samba.html

https://www.uetyi.mydns.jp/wordpress/linux-server/entry-23.html

https://sites.google.com/site/nakamulinux/Home/samba

https://www.obenri.com/_samba/about_samba.html

https://d.hatena.ne.jp/camellia1977/20120818/1345288125


APPLY NOW






    Benefits

    SALARY & BONUS POLICY

    RiverCrane Vietnam sympathizes staffs' innermost feelings and desires and set up termly salary review policy. Performance evaluation is conducted in June and December and salary change is conducted in January and July every year. Besides, outstanding staffs receive bonus for their achievements periodically (monthly, yearly).

    TRAINING IN JAPAN

    In order to broaden staffs' view about technologies over the world, RiverCrane Vietnam set up policy to send staffs to Japan for study. Moreover, the engineers can develop their career paths in technical or management fields.

    ANNUAL COMPANY TRIP

    Not only bringing chances to the staffs for their challenging, Rivercrane Vietnam also excites them with interesting annual trips. Exciting Gala Dinner with team building games will make the members of Rivercrane connected closer.

    COMPANY'S EVENTS

    Activities such as Team Building, Company Building, Family Building, Summer Holiday, Mid-Autum Festival, etc. will be the moments worthy of remembrance for each individual in the project or the pride when one introduces the company to his or her family, and shares the message "We are One".

    INSURANCE

    Rivercrane Vietnam ensures social insurance, medical insurance and unemployment insurance for staffs. The company commits to support staffs for any procedures regarding these insurances. In addition, other insurance policies are taken into consideration and under review.

    OTHER BENEFITS

    Support budget for activities related to education, entertainment and sports. Support fee for purchasing technical books. Support fee for getting engineering or language certificates. Support fee for joining courses regarding technical management. Other supports following company's policy, etc.

    © 2012 RiverCrane Vietnam. All rights reserved.

    Close