广告

本站里的文章大部分经过自行整理与测试

2016年12月28日星期三

Linux - Samba 服务 / 客户端

Samba 服务需要打开防火壁端口 139 和 445

Ubuntu

# Samba 服务与客户端安装
$ sudo apt-get install samba smbclient

# Samba 管理界面

$ sudo apt-get install system-config-samba
# 需要这个文件, 否则 Samba 管理界面无法运行
$ sudo touch /etc/libuser.conf
# 运行
$ sudo system-config-samba

Fedora

$ sudo dnf install samba samba-client

$ wget ftp://ftp.pbone.net/mirror/ftp5.gwdg.de/pub/opensuse/repositories/home:/Kenzy:/modified:/C7/CentOS_7/noarch/system-config-samba-1.2.100-2.1.noarch.rpm
$ wget ftp://ftp.pbone.net/mirror/ftp5.gwdg.de/pub/opensuse/repositories/home:/Kenzy:/modified:/C7/CentOS_7/noarch/system-config-samba-docs-1.0.9-2.1.noarch.rpm

$ sudo dnf install system-config-samba-docs-1.0.9-2.1.noarch.rpm system-config-samba-1.2.100-2.1.noarch.rpm --allowerasing
$ sudo setsebool -P samba_enable_home_dirs 1

CentOS

$ sudo yum install samba samba-client

$ wget ftp://ftp.pbone.net/mirror/ftp5.gwdg.de/pub/opensuse/repositories/home:/Kenzy:/modified:/C7/CentOS_7/noarch/system-config-samba-1.2.100-2.1.noarch.rpm
$ wget ftp://ftp.pbone.net/mirror/ftp5.gwdg.de/pub/opensuse/repositories/home:/Kenzy:/modified:/C7/CentOS_7/noarch/system-config-samba-docs-1.0.9-2.1.noarch.rpm

$ sudo yum install system-config-samba-docs-1.0.9-2.1.noarch.rpm system-config-samba-1.2.100-2.1.noarch.rpm
$ sudo setsebool -P samba_enable_home_dirs 1

OpenSUSE

$ sudo zypper install samba samba-client

去 YaST 找 Samba Server 可以设置..

# Samba 服务开启 (start / stop / restart / status)
$ sudo service smb status
$ sudo service smb restart

$ sudo systemctl status smbd
$ sudo systemctl restart smbd

# 设置 Samba 用户密码
$ sudo smbpasswd -a username

# 列出所有 Shared Folders
$ smbclient -L 192.168.0.1 -U username

$ smbclient -c "ls" //192.168.0.1/Share -U username
$ smbclient -c "mkdir Share" //192.168.0.1/Share -U username

$ smbclient //192.168.0.1/Share -U username
$ smb:/>ls
$ smb:/>cd Share
$ smb:/>exit

没有评论:

发表评论