废弃主机安装ubuntu开samba文件夹共享给小米摄像机监控NAS存储

安装ssh
sudo apt-get install openssh-server
sudo systemctl enable --now ssh
sudo apt-get install net-tools
mac终端连入ubuntu主机ssh
ssh 用户名@IP
ubuntu安装samba
sudo apt update
sudo apt upgrade
sudo apt-get install samba
mkdir /share
sudo chmod 777 /share -R
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.bak

-------------以上为当前磁盘目录/share添加到共享-----------------
sudo mkfs.ext2 /dev/sdb
sudo mkdir /mnt/sdb
sudo mount /dev/sdb /mnt/sdb
sudo chmod 777 /dev/sdb -R
sudo chmod 777 /mnt/sdb -R
-----------以上为单独磁盘映射后添加共享------------------------

sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.bak
sudo nano /etc/samba/smb.conf
----------文件底部添加,可添加多个[共享标签]对应指定目录----------
[nas]
comment = Samba Share
path = /share
valid users = naser
writable = yes
browsable = yes
guest ok = yes
read only = no
create mask = 0777
directory mask = 0777

添加用户
sudo systemctl restart smbd
sudo useradd -m naser
sudo passwd naser
sudo smbpasswd -a naser

防火墙端口
sudo ufw allow 139/tcp
sudo ufw allow 445/tcp

sudo nano /etc/samba/smb.conf
在[global]下添加
server min protocol = NT1

sudo systemctl restart smbd
sudo systemctl start nmbd
sudo systemctl enable nmbd

posted @ 2023-11-03 22:53  米和大肉  阅读(107)  评论(0编辑  收藏  举报