Samba: Server setup..

To make samba shard folder permission clear, there are 3 kind of permission need to be paid attention:

1. permission written in /etc/samba/smb.conf of certain folder

2. folder need to be shared by be labeled as samba_shared_t, check by ls -ldZ (Note: needed only while under SElinux environment)

3. folder's own permission according to the login-user. check it by ls -l, best to change the folder's owner by chown.

2 days passed, and I finally find it done with samba server.. with utube

to set up a samba server:

1. install samba;

2. add /etc/samba/smb.conf to the tail: (also if sure about safety of network environment, turn off smb encryption by adding 'smb encrypt = disabled' to [global] section of smb.conf)

[wwt]  # This is the shared folder name displayed in the guest
path = /home/wwt # This is the dest folder in the host
available = yes
valid users = wwt root # space seperated [vital]
writable = yes
write list = wwt root # users guaranteed to write the folder
browseable = yes
public = yes
workgroup = ADMIN # This line is for windows users to login, no use in linux

3. chcon -t samba_share_t /home/wwt -R (Changing SElinux security context)

to make all the folder/file be samba_shared_t.

4. add samba user wwt/root [ the mentioned user wwt in the smb.conf]:

smbpasswd -a wwt
smbpasswd -a root

In linux guest:

smbclient -L 10.0.5.2
smbclient \\\\10.0.5.2\\wwt password

In windows guest:

win-r<CR>
\\10.0.5.2

the test finished.

but if want to put into real work circumstances.. we need yum install cifs-utils:

# first install the mount.cifs tool
mount.cifs //10.0.5.2/wwt /mnt/wwt -o user=wwt,pass=123456
# input the password
cd /mnt/wwt
# done..

------Another need----

We have 1 remote linux server, 1 local linux machine and 1 windows.

The need is to let the local linux sshfs mount the remote linux dir, and let windows access the files through samba service.

Several things to do:

1. the remote linux should have port 22 and sshd service enabled;

2. the local linux machine should sshfs mount the remote dir with option 'allow_other', by:

# Uncomment #user_allow_other in fuse.conf
vim /etc/fuse.conf
# sshfs mount remote dir
sshfs user@machine:/path/to/dir /local/path -C -o allow_other -o umask 0000 -o delay_connect -o reconnect -o IdentityFile=/home/.ssh/id_rsa

3. local linux machine should have samba installed (service port accessible), and configure the /etc/samba/smb.conf (there is no need to restart smbd.service), set user passwd by smbpasswd user...

4. windows side type \\localmachine

上一篇:直播P2P技术1-技术入门


下一篇:CC攻击网站和游戏如何针对性预防?