Ubuntu 上 Samba 无法启动

Ubuntu 上 Samba 无法启动

我有这个输出

 user123@Matrix-Server:~$ /etc/init.d/samba stop
    bash: /etc/init.d/samba: No such file or directory
    sputnik@Matrix-Server:~$ sudo /etc/init.d/samba restart
    sudo: /etc/init.d/samba: command not found
    user123@Matrix-Server:~$ 

 user123@Matrix-Server:~$ sudo apt-get install samba smbfs
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    samba is already the newest version.
    smbfs is already the newest version.
    The following packages were automatically installed and are no longer required:
      linux-headers-2.6.32-19-generic linux-headers-2.6.32-19
    Use 'apt-get autoremove' to remove them.
    0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

答案1

Samba 由两个独立的守护进程组成:

  • 中小企业提供文件和打印机共享服务
  • 纳米比亚提供 NetBIOS 到 IP 地址的名称服务

要完全重启 Samba,你需要重启它们两个,因此正确的命令顺序是

sudo /etc/init.d/smbd restart
sudo /etc/init.d/nmbd restart

或者更“ubuntish”方式

sudo service smbd restart
sudo service nmbd restart

答案2

sudo /etc/init.d/samba start

尝试一下或者尝试一下

cd /etc/init.d/
sudo ./samba start

如果失败,请重新安装 samba:

sudo apt-get install --reinstall samba

然后尝试重新启动它。

答案3

您也可以在一行中运行此命令

restart smbd && restart nmbd

如果这不起作用,请选择 Fen0x 的建议。

答案4

更新谁使用Raspberry Pi

  1. samba找不到命令
$ sudo /etc/init.d/samba restart
sudo: /etc/init.d/samba: command not found
  1. 找出新的服务名称samba
$ ls -al /etc/init.d/ | grep -E "\ss"
-rwxr-xr-x   1 root root 2259 Aug  1  2022 samba-ad-dc
-rwxr-xr-x   1 root root 2224 Apr 15  2018 saned
-rwxr-xr-x   1 root root 2061 Aug  1  2022 smbd
-rwxr-xr-x   1 root root 4056 Jul  2  2022 ssh
-rwxr-xr-x   1 root root 1030 Jan 14  2023 sudo
  1. 重启smbd服务
$ sudo /etc/init.d/smbd restart
Restarting smbd (via systemctl): smbd.service.

# OR
$ sudo systemctl restart smbd
# OR
$ sudo systemctl restart smbd.service

截屏

在此处输入图片描述

裁判

https://www.digitalocean.com/community/tutorials/how-to-use-systemctl-to-manage-systemd-services-and-units

相关内容