Linux samba配置
作者:互联网
1、查看是否安装samba
sxt@ubuntu:~$ rpm -qa|grep samba
sxt@ubuntu:~$ samba
sxt@ubuntu:~$ rpm -qa|grep samba //命令查看
The program 'rpm' is currently not installed. You can install it by typing:
sudo apt install rpm
根据提示安装
sxt@ubuntu:~$ samba
The program 'samba' is currently not installed. You can install it by typing:
sudo apt install samba
sxt@ubuntu:~$ samba
[2021/12/31 23:48:46.738349, 0] ../lib/util/debug.c:947(reopen_logs_internal)
Unable to open new log file '/var/log/samba/log.%m': Permission denied
[2021/12/31 23:48:46.738439, 0] ../source4/smbd/server.c:372(binary_smbd_main)
samba version 4.3.11-Ubuntu started.
Copyright Andrew Tridgell and the Samba Team 1992-2015
2、查看smb服务是否启动—active(running)代表已启动
sxt@ubuntu:~$ /etc/init.d/smbd status
sxt@ubuntu:~$ service smbd status
sxt@ubuntu:~$ service smbd status
● smbd.service - LSB: start Samba SMB/CIFS daemon (smbd)
Loaded: loaded (/etc/init.d/smbd; bad; vendor preset: enabled)
Active: active (running) since Fri 2021-12-31 23:46:08 PST; 10min ago
Docs: man:systemd-sysv-generator(8)
CGroup: /system.slice/smbd.service
├─7961 /usr/sbin/smbd -D
├─7963 /usr/sbin/smbd -D
└─7981 /usr/sbin/smbd -D
Dec 31 23:46:07 ubuntu systemd[1]: Starting LSB: start Samba SMB/CIFS daemon (smbd)...
Dec 31 23:46:08 ubuntu smbd[7949]: * Starting SMB/CIFS daemon smbd
Dec 31 23:46:08 ubuntu smbd[7949]: ...done.
Dec 31 23:46:08 ubuntu systemd[1]: Started LSB: start Samba SMB/CIFS daemon (smbd).
Dec 31 23:54:23 ubuntu systemd[1]: Started LSB: start Samba SMB/CIFS daemon (smbd).
3、开启、停止、重启服务
sxt@ubuntu:~$ sudo /etc/init.d/smbd stop //停止服务
[ ok ] Stopping smbd (via systemctl): smbd.service.
sxt@ubuntu:~$ sudo /etc/init.d/smbd start //启动服务
[ ok ] Starting smbd (via systemctl): smbd.service.
sxt@ubuntu:~$ sudo /etc/init.d/smbd restart //重启服务
[ ok ] Restarting smbd (via systemctl): smbd.service.
sxt@ubuntu:~$ sudo /etc/init.d/smbd status //查看状态
● smbd.service - LSB: start Samba SMB/CIFS daemon (smbd)
Loaded: loaded (/etc/init.d/smbd; bad; vendor preset: enabled)
Active: active (running) since Sat 2022-01-01 00:05:49 PST; 17s ago
4、配置文件
sxt@ubuntu:~$ ls /etc/samba/
gdbcommands smb.conf tls
sxt@ubuntu:~$ sudo vim /etc/samba/smb.conf
在最后添加
[share]
comment = my_samba //说明信息
path = /home/sxt/share //share为共享的文件夹
browseable = yes //可浏览权限
writeable = yes
5、添加用户
sxt@ubuntu:~$ sudo smbpasswd -a sxt
New SMB password:
Retype new SMB password:
Added user sxt.
6、window映射网络驱动器即可
\\\server\share server为ubuntu的ip,share为用户名
标签:samba,Linux,23,配置,etc,sxt,ubuntu,smbd 来源: https://blog.csdn.net/qq_41177909/article/details/122268115