plamo6.2->network

ファイル共有

windowsも使うのでsambaです

samba

4.5.8をソースから入れました。 実行ファイル類は /usr/local/samba/ 以下にセットアップされます $ ./configure --without-regedit
$ make
# make install

/etc/profile

/usr/bin, /usr/sbin 以下に元から入っているものをうっかり使わないように、パスを追加しておきます。

..
PATH="/usr/local/samba/sbin:/usr/local/samba/bin:$PATH"
export PATH
..

smb.conf

/usr/local/samba/etc/smb.conf が設定ファイルになっています。 設定ファイルを /etc/ に置きたいので、/etc/smb.conf へのシンボリックリンクを /usr/local/samba/etc/ に作成します。

# cd /usr/local/samba/bin/
# ./testparm
 Load smb config files from /usr/local/samba/etc/smb.conf 'smb.conf へのパスを確認
 ....
# cd /usr/local/samba/etc/
# ln -s /etc/smb.conf . '/etc/smb.conf へのシンボリックリンクを作成
# cd /etc
# touch smb.conf ' 空っぽの smb.conf を作成

[↓ 設定例 ↓]

#
# smb.conf 
# ( for samba 4.5.8 @ plum '2017-05-15 )
#
[global]
	dos charset = CP932
	unix charset = EUCJP-MS
	
	workgroup = UNZU-GUMI
	netbios name = (name)
	server string = (name)

	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 = xxx.xxx.x.

	# 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

[tamuro]
	path = /export/1/tamuro
	comment = Common-tamuro
	browseable = yes
	force group = users
	force create mode = 0664
	force directory mode = 0775
	valid users = (user1) (user2) ...
	write list = (user1) (user2) ...
	writable = yes
	; guest ok = yes

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

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

# smbpasswd -a (username)

WindowsXPからのユーザー認証

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以降でも同様な対応が必要になることがあるらしいのですが、 ウチのwindows7に対しては必要ありませんでした。(謎)

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

スマートフォンへの転送

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

$ lftp
lftp (site):(path)> open -p (port) xxxxxxx
lftp (site):(path)> mirror --reverse --delete --only-newer

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




tsushiro.s, 2004-2017.