日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

家庭NAS搭建实战之samba共享

發布時間:2025/4/16 编程问答 25 豆豆
生活随笔 收集整理的這篇文章主要介紹了 家庭NAS搭建实战之samba共享 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

家庭NAS搭建實戰之samba共享

  • 一、系統環境
  • 二、配置倉庫源
    • 1.備份原有倉庫源
    • 2.配置新debain源
    • 3.更新debain源
  • 二、安裝samba軟件
    • 1.安裝軟件
    • 2.設置共享目錄
    • 3.設置共享目錄權限
    • 4.新建samba用戶
    • 5.查看smba用戶列表
  • 三、修改samba配置文件
  • 四、測試配置文件
  • 五、設置開機自啟服務
  • 六、測試登錄

一、系統環境

root@onecloud:~# cat /etc/os-release PRETTY_NAME="Debian GNU/Linux 9 (stretch)" NAME="Debian GNU/Linux" VERSION_ID="9" VERSION="9 (stretch)" VERSION_CODENAME=stretch ID=debian HOME_URL="https://www.debian.org/" SUPPORT_URL="https://www.debian.org/support" BUG_REPORT_URL="https://bugs.debian.org/" root@onecloud:~#

二、配置倉庫源

1.備份原有倉庫源

cp /etc/apt/sources.list /etc/apt/sources.listbak #備份原有配置文件

2.配置新debain源

deb http://mirrors.aliyun.com/debian/ stretch main non-free contrib deb-src http://mirrors.aliyun.com/debian/ stretch main non-free contrib deb http://mirrors.aliyun.com/debian-security stretch/updates main deb-src http://mirrors.aliyun.com/debian-security stretch/updates main deb http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib deb-src http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib #deb http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib #deb-src http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib

3.更新debain源

apt-get update

二、安裝samba軟件

1.安裝軟件

root@onecloud:/var/lib/dpkg# apt-get install -y samba

2.設置共享目錄

mkdir -p /data/NAS/nas

3.設置共享目錄權限

root@onecloud:~# chmod 777 /data/NAS/nas/ root@onecloud:~# ls -ld /data/NAS/nas/ drwxrwxrwx 3 root root 4096 Jan 24 22:53 /data/NAS/nas/

4.新建samba用戶

root@onecloud:~# groupadd it root@onecloud:~# useradd -g it admin root@onecloud:~# sabpasswd -a adminroot@onecloud:~# smbpasswd -a admin New SMB password: root@onecloud:~# smbpasswd -a admin New SMB password: Retype new SMB password: Added user admin.

5.查看smba用戶列表

root@onecloud:~# pdbedit -L admin:1003: root@onecloud:~#

三、修改samba配置文件

root@onecloud:~# vim /etc/samba/smb.conf [share]path = /data/NAS/nas/browseable = yeswrite list = @ithosts allow = 192.168.3.0/24

四、測試配置文件

root@onecloud:~# testparm /etc/samba/smb.conf Load smb config files from /etc/samba/smb.conf rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384) Processing section "[share]" Loaded services file OK. Server role: ROLE_STANDALONEPress enter to see a dump of your service definitions# Global parameters [global]idmap config * : backend = tdb[share]path = /data/NAS/nas/hosts allow = 192.168.3.0/24write list = @it root@onecloud:~#

五、設置開機自啟服務

root@onecloud:~# systemctl start smbd root@onecloud:~# systemctl enable smbd Synchronizing state of smbd.service with SysV service script with /lib/systemd/systemd-sysv-install. Executing: /lib/systemd/systemd-sysv-install enable smbd root@onecloud:~#

六、測試登錄

windows電腦登錄

總結

以上是生活随笔為你收集整理的家庭NAS搭建实战之samba共享的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。