#author("2025-04-21T14:59:05+09:00","","") #author("2025-05-13T13:54:06+09:00","","") #nofollow #norelated 総数:&counter(total); 今日:&counter(today); 昨日:&counter(yesterday); * もくじ [#gc5000a8] #contents &size(22){&color(blue){setting up file sharing with windows11 on ubuntu desktop 24.04.2};};&br; 参考url: &br; [[【2025年04月版】Ubuntu24.04 で Samba で Windowsとファイル共有>https://qiita.com/nouernet/items/4490b039e1351353fb47]]&br; *前提条件 [#t6ff5958] |項目|説明|備考|h |SIZE(20):環境|SIZE(20):ubuntu24.04.2|| |SIZE(20):共有するフォルダ|SIZE(20):/home/ryu/Public|| |SIZE(20):UbuntuのサーバのIPアドレス|SIZE(20):192.168.3.13|| |SIZE(20):共有を使うユーザ|SIZE(20):ryu|| *インストール [#wda6af90] $ sudo apt update $ sudo apt install samba パッケージリストを読み込んでいます... 完了 依存関係ツリーを作成しています... 完了 状態情報を読み取っています... 完了 以下の追加パッケージがインストールされます: attr libcephfs2 librados2 librdmacm1t64 liburing2 python3-dnspython python3-gpg python3-ldb python3-markdown python3-samba python3-talloc python3-tdb samba-ad-provision samba-common samba-common-bin samba-dsdb-modules samba-vfs-modules tdb-tools 提案パッケージ: python3-trio python3-aioquic python3-h2 python3-httpx python3-httpcore python-markdown-doc bind9 bind9utils ctdb ldb-tools ntp | chrony winbind heimdal-clients 以下のパッケージが新たにインストールされます: attr libcephfs2 librados2 librdmacm1t64 liburing2 python3-dnspython python3-gpg python3-ldb python3-markdown python3-samba python3-talloc python3-tdb samba samba-ad-provision samba-common samba-common-bin samba-dsdb-modules samba-vfs-modules tdb-tools アップグレード: 0 個、新規インストール: 19 個、削除: 0 個、保留: 0 個。 11.9 MB のアーカイブを取得する必要があります。 この操作後に追加で 70.7 MB のディスク容量が消費されます。 続行しますか? [Y/n] Y 取得:1 http://jp.archive.ubuntu.com/ubuntu noble/main amd64 python3-dnspython all 2.6.1-1ubuntu1 [163 kB] 取得:2 http://jp.archive.ubuntu.com/ubuntu noble/main amd64 python3-ldb amd64 2:2.8.0+samba4.19.5+dfsg-4ubuntu9 [41.8 kB] 取得:3 http://jp.archive.ubuntu.com/ubuntu noble/main amd64 python3-tdb amd64 1.4.10-1build1 [15.3 kB] 取得:4 http://jp.archive.ubuntu.com/ubuntu noble/main amd64 python3-markdown all 3.5.2-1 [72.0 kB] 取得:5 http://jp.archive.ubuntu.com/ubuntu noble/main amd64 python3-talloc amd64 2.4.2-1build2 [12.9 kB] 取得:6 http://jp.archive.ubuntu.com/ubuntu noble/main amd64 python3-samba amd64 2:4.19.5+dfsg-4ubuntu9 [2,895 kB] 取得:7 http://jp.archive.ubuntu.com/ubuntu noble/main amd64 samba-common all 2:4.19.5+dfsg-4ubuntu9 [64.1 kB] 取得:8 http://jp.archive.ubuntu.com/ubuntu noble/main amd64 samba-common-bin amd64 2:4.19.5+dfsg-4ubuntu9 [1,279 kB] 取得:9 http://jp.archive.ubuntu.com/ubuntu noble/main amd64 tdb-tools amd64 1.4.10-1build1 [25.8 kB] 取得:10 http://jp.archive.ubuntu.com/ubuntu noble/main amd64 samba amd64 2:4.19.5+dfsg-4ubuntu9 [1,004 kB] 取得:11 http://jp.archive.ubuntu.com/ubuntu noble-updates/main amd64 attr amd64 1:2.5.2-1build1.1 [22.8 kB] 取得:12 http://jp.archive.ubuntu.com/ubuntu noble/main amd64 librdmacm1t64 amd64 50.0-2build2 [70.7 kB] 取得:13 http://jp.archive.ubuntu.com/ubuntu noble-updates/main amd64 librados2 amd64 19.2.0-0ubuntu0.24.04.2 [3,972 kB] 取得:14 http://jp.archive.ubuntu.com/ubuntu noble-updates/main amd64 libcephfs2 amd64 19.2.0-0ubuntu0.24.04.2 [826 kB] 取得:15 http://jp.archive.ubuntu.com/ubuntu noble/main amd64 liburing2 amd64 2.5-1build1 [21.1 kB] 取得:16 http://jp.archive.ubuntu.com/ubuntu noble/main amd64 python3-gpg amd64 1.18.0-4.1ubuntu4 [209 kB] 取得:17 http://jp.archive.ubuntu.com/ubuntu noble/main amd64 samba-ad-provision all 2:4.19.5+dfsg-4ubuntu9 [487 kB] 取得:18 http://jp.archive.ubuntu.com/ubuntu noble/main amd64 samba-dsdb-modules amd64 2:4.19.5+dfsg-4ubuntu9 [317 kB] 取得:19 http://jp.archive.ubuntu.com/ubuntu noble/main amd64 samba-vfs-modules amd64 2:4.19.5+dfsg-4ubuntu9 [414 kB] 11.9 MB を 3秒 で取得しました (4,454 kB/s) 以前に未選択のパッケージ python3-dnspython を選択しています。 (データベースを読み込んでいます ... 現在 247257 個のファイルとディレクトリがイン ストールされています。) .../00-python3-dnspython_2.6.1-1ubuntu1_all.deb を展開する準備をしています ... python3-dnspython (2.6.1-1ubuntu1) を展開しています... 以前に未選択のパッケージ python3-ldb を選択しています。 .../01-python3-ldb_2%3a2.8.0+samba4.19.5+dfsg-4ubuntu9_amd64.deb を展開する準備 をしています ... python3-ldb (2:2.8.0+samba4.19.5+dfsg-4ubuntu9) を展開しています... 以前に未選択のパッケージ python3-tdb を選択しています。 .../02-python3-tdb_1.4.10-1build1_amd64.deb を展開する準備をしています ... python3-tdb (1.4.10-1build1) を展開しています... 以前に未選択のパッケージ python3-markdown を選択しています。 .../03-python3-markdown_3.5.2-1_all.deb を展開する準備をしています ... python3-markdown (3.5.2-1) を展開しています... 以前に未選択のパッケージ python3-talloc:amd64 を選択しています。 .../04-python3-talloc_2.4.2-1build2_amd64.deb を展開する準備をしています ... python3-talloc:amd64 (2.4.2-1build2) を展開しています... 以前に未選択のパッケージ python3-samba を選択しています。 .../05-python3-samba_2%3a4.19.5+dfsg-4ubuntu9_amd64.deb を展開する準備をしています ... python3-samba (2:4.19.5+dfsg-4ubuntu9) を展開しています... 以前に未選択のパッケージ samba-common を選択しています。 .../06-samba-common_2%3a4.19.5+dfsg-4ubuntu9_all.deb を展開する準備をしています ... samba-common (2:4.19.5+dfsg-4ubuntu9) を展開しています... 以前に未選択のパッケージ samba-common-bin を選択しています。 .../07-samba-common-bin_2%3a4.19.5+dfsg-4ubuntu9_amd64.deb を展開する準備をしています ... samba-common-bin (2:4.19.5+dfsg-4ubuntu9) を展開しています... 以前に未選択のパッケージ tdb-tools を選択しています。 .../08-tdb-tools_1.4.10-1build1_amd64.deb を展開する準備をしています ... tdb-tools (1.4.10-1build1) を展開しています... 以前に未選択のパッケージ samba を選択しています。 .../09-samba_2%3a4.19.5+dfsg-4ubuntu9_amd64.deb を展開する準備をしています ... samba (2:4.19.5+dfsg-4ubuntu9) を展開しています... 以前に未選択のパッケージ attr を選択しています。 .../10-attr_1%3a2.5.2-1build1.1_amd64.deb を展開する準備をしています ... attr (1:2.5.2-1build1.1) を展開しています... 以前に未選択のパッケージ librdmacm1t64:amd64 を選択しています。 .../11-librdmacm1t64_50.0-2build2_amd64.deb を展開する準備をしています ... librdmacm1t64:amd64 (50.0-2build2) を展開しています... 以前に未選択のパッケージ librados2 を選択しています。 .../12-librados2_19.2.0-0ubuntu0.24.04.2_amd64.deb を展開する準備をしています ... librados2 (19.2.0-0ubuntu0.24.04.2) を展開しています... 以前に未選択のパッケージ libcephfs2 を選択しています。 .../13-libcephfs2_19.2.0-0ubuntu0.24.04.2_amd64.deb を展開する準備をしています ... libcephfs2 (19.2.0-0ubuntu0.24.04.2) を展開しています... 以前に未選択のパッケージ liburing2:amd64 を選択しています。 .../14-liburing2_2.5-1build1_amd64.deb を展開する準備をしています ... liburing2:amd64 (2.5-1build1) を展開しています... 以前に未選択のパッケージ python3-gpg を選択しています。 .../15-python3-gpg_1.18.0-4.1ubuntu4_amd64.deb を展開する準備をしています ... python3-gpg (1.18.0-4.1ubuntu4) を展開しています... 以前に未選択のパッケージ samba-ad-provision を選択しています。 .../16-samba-ad-provision_2%3a4.19.5+dfsg-4ubuntu9_all.deb を展開する準備をしています ... samba-ad-provision (2:4.19.5+dfsg-4ubuntu9) を展開しています... 以前に未選択のパッケージ samba-dsdb-modules:amd64 を選択しています。 .../17-samba-dsdb-modules_2%3a4.19.5+dfsg-4ubuntu9_amd64.deb を展開する準備をしています ... samba-dsdb-modules:amd64 (2:4.19.5+dfsg-4ubuntu9) を展開しています... 以前に未選択のパッケージ samba-vfs-modules:amd64 を選択しています。 .../18-samba-vfs-modules_2%3a4.19.5+dfsg-4ubuntu9_amd64.deb を展開する準備をしています ... samba-vfs-modules:amd64 (2:4.19.5+dfsg-4ubuntu9) を展開しています... python3-talloc:amd64 (2.4.2-1build2) を設定しています ... attr (1:2.5.2-1build1.1) を設定しています ... samba-common (2:4.19.5+dfsg-4ubuntu9) を設定しています ... Creating config file /etc/samba/smb.conf with new version python3-tdb (1.4.10-1build1) を設定しています ... python3-gpg (1.18.0-4.1ubuntu4) を設定しています ... tdb-tools (1.4.10-1build1) を設定しています ... update-alternatives: /usr/bin/tdbbackup (tdbbackup) を提供するために自動モードで /usr/bin/tdbbackup.tdbtools を使います python3-ldb (2:2.8.0+samba4.19.5+dfsg-4ubuntu9) を設定しています ... python3-markdown (3.5.2-1) を設定しています ... python3-dnspython (2.6.1-1ubuntu1) を設定しています ... samba-ad-provision (2:4.19.5+dfsg-4ubuntu9) を設定しています ... librdmacm1t64:amd64 (50.0-2build2) を設定しています ... samba-dsdb-modules:amd64 (2:4.19.5+dfsg-4ubuntu9) を設定しています ... liburing2:amd64 (2.5-1build1) を設定しています ... python3-samba (2:4.19.5+dfsg-4ubuntu9) を設定しています ... librados2 (19.2.0-0ubuntu0.24.04.2) を設定しています ... samba-vfs-modules:amd64 (2:4.19.5+dfsg-4ubuntu9) を設定しています ... libcephfs2 (19.2.0-0ubuntu0.24.04.2) を設定しています ... samba-common-bin (2:4.19.5+dfsg-4ubuntu9) を設定しています ... samba (2:4.19.5+dfsg-4ubuntu9) を設定しています ... Created symlink /etc/systemd/system/smb.service → /usr/lib/systemd/system/smbd.service. Created symlink /etc/systemd/system/multi-user.target.wants/smbd.service → /usr/lib/systemd/system/smbd.service. Created symlink /etc/systemd/system/nmb.service → /usr/lib/systemd/system/nmbd.service. Created symlink /etc/systemd/system/multi-user.target.wants/nmbd.service → /usr/lib/systemd/system/nmbd.service. Created symlink /etc/systemd/system/samba.service → /usr/lib/systemd/system/samba-ad-dc.service. Created symlink /etc/systemd/system/multi-user.target.wants/samba-ad-dc.service → /usr/lib/systemd/system/samba-ad-dc.service. ufw (0.36.2-6) のトリガを処理しています ... man-db (2.12.0-4build2) のトリガを処理しています ... libc-bin (2.39-0ubuntu8.4) のトリガを処理しています ... ryu@HP-Compaq-Elite-8300-SFF:~$ *設定 [#nc5a38aa] **samba の設定ファイル /etc/samba/smb.conf を編集する [#g2da1531] ~$ diff -uprN /etc/samba/smb.conf.orig /etc/samba/smb.conf ~$ diff -uprN --color /etc/samba/smb.conf.orig /etc/samba/smb.conf --- /etc/samba/smb.conf.orig 2024-04-08 23:49:25.000000000 +0900 +++ /etc/samba/smb.conf 2025-04-21 13:24:18.685881963 +0900 @@ -216,23 +216,25 @@ ; create mask = 0600 ; directory mask = 0700 -[printers] - comment = All Printers - browseable = no - path = /var/tmp - printable = yes - guest ok = no - read only = yes - create mask = 0700 +security = user + +;[printers] +; comment = All Printers +; browseable = no +; path = /var/tmp +; printable = yes +; guest ok = no +; read only = yes +; create mask = 0700 # Windows clients look for this share name as a source of downloadable # printer drivers -[print$] - comment = Printer Drivers - path = /var/lib/samba/printers - browseable = yes - read only = yes - guest ok = no +;[print$] +; comment = Printer Drivers +; path = /var/lib/samba/printers +; browseable = yes +; read only = yes +; guest ok = no # Uncomment to allow remote administration of Windows print drivers. # You may need to replace 'lpadmin' with the name of the group your # admin users are members of. @@ -240,3 +242,14 @@ # to the drivers directory for these users to have write rights in it ; write list = root, @lpadmin +[shared] + comment = ubuntu24.04 share + path = /home/ryu/Public + available = yes + read only = no + browsable = yes + public = no + writable = yes + guest ok = no + valid users = ryu + ~$ **samba の設定ファイルの編集内容をチェックする [#k04045ca] ~$ testparm Load smb config files from /etc/samba/smb.conf Loaded services file OK. Weak crypto is allowed by GnuTLS (e.g. NTLM as a compatibility fallback) WARNING: The 'netbios name' is too long (max. 15 chars). Server role: ROLE_STANDALONE Press enter to see a dump of your service definitions # Global parameters [global] log file = /var/log/samba/log.%m logging = file map to guest = Bad User max log size = 1000 obey pam restrictions = Yes pam password change = Yes panic action = /usr/share/samba/panic-action %d passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* . passwd program = /usr/bin/passwd %u security = USER server role = standalone server server string = %h server (Samba, Ubuntu) unix password sync = Yes usershare allow guests = Yes idmap config * : backend = tdb [shared] comment = ubuntu24.04 share path = /home/ryu/Public read only = No valid users = ryu ~$ **ユーザのsambaのパスワードを設定する [#e375e551] ~$ sudo smbpasswd -a ryu **フォルダの権限を設定する [#wd9273bc] ~$ sudo chown ryu:ryu /home/ryu/Public ~$ sudo chmod 755 /home/ryu/Public *サービスの再起動 [#x6e323f4] ~$ sudo systemctl restart smbd *サービスの自動起動の設定 [#r2ddda59] ~$ sudo systemctl enable smbd ~$ sudo systemctl enable nmbd *動作確認 [#f9c30fd4] **Windows [#q4e00722] -Windows端末から、Explorerで、 //192.168.3.13 の共有を開く -ユーザとパスワードを求められるので、ユーザ名 ryu 、入力したパスワード、を入力する