plamo8.2x->network

ファイル共有

windowsも使うのでsambaです

samba

plamo8.2xのセットアップ時にインストールされていますので、設定をして有効化します。

smb.conf

/etc/samba/smb.conf が設定ファイルになっています。 /etc/samba/に入っている smb.conf.dist を雛形にして、設定ファイルを作成します。

$ testparm
 Load smb config files from /etc/samba/smb.conf ( どのファイルが設定ファイルか分かります。)
( 設定ファイルがわかったところで、設定ファイルを作成します。)
# cd /etc/samba
# cp smb.conf.dist smb.conf
# vi smb.conf
....
# ./testparm  ( testparm でチェックします。)

testparmでチェックするとき、最初のチェックでは「/run/samba が無い」とエラーになるようです。 無いようであれば作ったら良いです。

[↓ 設定例 ↓]

# smb.conf 
# ( for samba @ apricot '2022-04-03 )
#
[global]
	dos charset = CP932
	unix charset = UTF8
	
	workgroup = UNZU-GUMI
	netbios name = apricot
	server string = apricot

	log file = /var/log/samba/log.%m
	log level = 3
	max log size = 50

	security = user
	encrypt passwords = yes
	ntlm auth = yes

	map to guest = Never
	# map to guest = Bad User
	# map to guest = Bad Password
	guest account = ftp
	hosts allow = 192.168.0.

	# WindowsNT LogonServer >> Never
	domain master = no
	local master = no
	preferred master =no
	os level =0

	# WINS
	wins support = no

	# DNS proxy
	dns proxy = no

	create mask = 0644
	map archive = no
	follow symlinks = yes

	# load printers = yes
	# cups options = raw

;[homes]
;	path = /export/1/%S/work
;	comment = work-%S
;	browseable = no
;	force group = users
;	force create mode = 0664
;	force directory mode = 0775
;	; valid users = %S
;	; write list = %S
;	writable = yes
;	; guest ok = yes

[work]
	path = /home/tsushiro/work
	comment = work
	browseable = yes
	force group = users
	force create mode = 0664
	force directory mode = 0775
	valid users = tsushiro
	write list = tsushiro
	writable = yes
	; guest ok = yes

;[printers]
;	comment = All printers
;	path = /var/spool/samba
;	browseable = no
;	guest ok = no
;	writable = no
;	printable = yes
;

sambaユーザーの追加

smbpasswdコマンドで、ユーザーを追加します。

# smbpasswd -a (username)

自動起動の設定

システム起動時の自動起動スクリプトを有効化します。

# cd /etc/rc.d/init.d
# chmod +x samba

WindowsXPからのユーザー認証(plamo7.0)

windowsXPからsamba共有へアクセスしようとするときに、 ユーザー名とパスワードは正しい(筈な)のにうまく認証されないとき。

ログレベルを設定して、アクセスログを見ると「このパスワード形式はダメだ」と言われている模様。

[ smb.conf の globalセクションに追加 ] log level = 3
[アクセスログより抜粋]
[2017/05/16 22:36:38.678601,  3] ../source3/passdb/lookup_sid.c:1645(get_primary_group_sid)
  Forcing Primary Group to 'Domain Users' for (Name)
[2017/05/16 22:36:38.678666,  2] ../libcli/auth/ntlm_check.c:424(ntlm_password_check)
  ntlm_password_check: NTLMv1 passwords NOT PERMITTED for user (Name)
[2017/05/16 22:36:38.678690,  3] ../libcli/auth/ntlm_check.c:431(ntlm_password_check)
  ntlm_password_check: NEITHER LanMan nor NT password supplied for user (Name)
[2017/05/16 22:36:38.678823,  2] ../source3/auth/auth.c:315(auth_check_ntlm_password)
  check_ntlm_password:  Authentication for user [tsushiro] -> [tsushiro] FAILED with error NT_STATUS_WRONG_PASSWORD

上記のとおり「NTLMv1形式のパスワード」がダメな模様。[参考]

オプションを追加して、NTLMv1形式を受け付けるようにします。

[ smb.conf の globalセクションに追加 ] ntlm auth = yes

windows7以降でも同様な対応が必要になることがあるそうです。

※上記 smb.conf は対処後のものになっています

拡張ACL

samba経由でコピーして持ってきたファイルを ls -l で見ると、変なパーミッションが付いていました。

$ ls -l
合計 353,210,368
-rw-rw-r--+ 1 tsushiro users    668,555 10月 23日  21:53 1.docx
-rw-r--r--  1 tsushiro users    665,687 10月 23日  22:08 12.docx
    ・
  (中略)
    ・
-rw-rw-r--+ 1 tsushiro users    656,656 10月 23日  21:53 3.docx

パーミッション記号の最後にある + は、拡張ACLが設定されていることを意味するそうです。 [参考] 操作には、setfacl, getfacl コマンド等を使います。

拡張ACLエントリは Windows由来のもので、 当方では意味がないので、sambaの設定を見直しして影響受けないようにしたいところ。 (今後の課題にします...) [参考]

拡張ACLエントリの表示

$ getfacl 1.docx
# file: 1.docx
# owner: tsushiro
# group: users
user::rw-
user:tsushiro:rw-
group::rw-
group:users:rw-
mask::rw-
other::r--

拡張ACLエントリの削除

$ setfacl -b (filename)

スマートフォンへの転送

スマートフォンでftpサーバを立てておき、PCからftpクライアントでアクセスすることにしました。 lftpを使うと、ミラーリングが可能です。

$ lftp
lftp (site):(path)> open -p (port) xxxxxxx
lftp (site):(path)> user <username> <password>
lftp (site):(path)> mirror --reverse --dereference --delete --only-newer

※ lftp には、llsコマンド が使えませんので、!lsを使うとよいです。




tsushiro.s, 2004-2024.