SMB HOWTO
David Wood,
[email protected]
v1.0, 10 August 1996
���앐�Y
[email protected]
v1.0j1, 24 September 1996
����� SMB HOWTO �ł��B���̕����� Linux �� Session Message Block (SMB)
�v���g�R��������@�ɂ��ďq�ׂ���̂ł��BSMB �v���g�R���́A NetBIOS
�v���g�R���ALanManager �v���g�R���Ƃ�Ă�Ă��܂��B
______________________________________________________________________
�ڎ�
1. �͂��߂�
2. ���̏��
3. �C���X�g�[��
4. �f�[������N������
5. /etc/smb.conf �̐ݒ�
6. Linux �̃h���C�u�� Windows �}�V�����狤�L����
7. Windows �̃h���C�u�� Linux �}�V���ŋ��L����
8. Linux �}�V���̃v�����^�� Windows �}�V�����痘�p����
9. Linux �}�V������ Windows �̃v�����^��g��
10. ���쌠
11. �ӎ�
______________________________________________________________________
1. �͂��߂�
����� SMB HOWTO �ł��B���̕����� Linux �� Session Message Block (SMB)
�v���g�R��������@�ɂ��ďq�ׂ���̂ł��BSMB �v���g�R���́A NetBIOS
�v���g�R���ALanManager �v���g�R���Ƃ�Ă�Ă��܂��B
���̕����� David Wood (
[email protected]) ���ҏW���Ă��܂��B�lj���
���C���A�����ɂ��Ẵ��[���́A���̃A�h���X�܂ł����肭������Ύ���
�̃����[�X�ɔ��f�����܂��B
SMB �v���g�R���� Microsoft Windows 3.11�ANT�A95 �Ńf�B�X�N��v�����^��
���L���邽�߂ɗp�����܂��BAndrew Tridgell �ɂ��ď����ꂽ Samba �c
�[���Z�b�g��p����ALinux �Ȃǂ� Unix �}�V���ł� Windows �̃z�X�g��
�f�B�X�N��v�����^��L�ł��܂��B
Samba ��p���Ăł��邱�Ƃ͈ȉ��� 4 �ł��B
1. Linux �z�X�g�̃h���C�u�� Windows �z�X�g�ŋ��L����B
2. Windows �z�X�g�̃h���C�u�� Linux �z�X�g�ŋ��L����B
3. Linux �z�X�g�̃v�����^�� Windows �z�X�g�ŋ��L����B
4. Windows �z�X�g�̃v�����^�� Linux �z�X�g�ŋ��L����B
���̕����͈ȏ�̃P�[�X��ׂăJ�o�[���Ă��܂��B
�Ɛ�: ���̕����ɋL�������@��X�N���v�g�́A���҂�܂߂����l���̃O���[�v
�̒��ł͂��܂������Ă��܂��B�����������قȂ�ƁA���܂������Ȃ��\��
����܂��B���̂悤�ȏꍇ�͒��҂Ƀ��[���Œm�点�Ă���������A���̕�
���̔��W�ɖ𗧂��܂��B���������҂͉��̕ۏ��܂���B����҂��Ă���
�ł����H���҂͂���������Ă���ɂ����Ȃ��̂ł�...
2. ���̏��
���� HOWTO �����ł́ALinux �}�V���� SMB �̃t�@�C���T�[�r�X�A�v�����g�T
�[�r�X�𗘗p���邽�߂̐ݒ�@�ɂ��āA��b��������Ă��܂��BSamba ��
���G�ō��@�\�ȃV�X�e���ł��̂ŁA���̕����ł� Samba �Ɋւ����ׂ�
��L�q���邱�Ƃ͂ł��܂��A�܂����̂�����܂���B
��葽���̏���m�肽���l�͈ȉ��̕�����݂Ă��������B
o Samba �̔z�z�p�b�P�[�W�Ɋ܂܂��h�L�������g�B�z�z�p�b�P�[�W��
<
ftp://nimbus.anu.edu.au/pub/tridge/samba/> ����擾�ł��܂��B
o Linux Printing HOWTO
o Print2Win mini HOWTO
===��===
����� Samba �����~���[�T�[�o�Ƃ��ẮA
<
ftp://ring.aist.go.jp/archives/net/samba/> <
ftp://ring.asahi-
net.or.jp/archives/net/samba/> �Ȃǂ�����܂��B���̖|�����Ă���
'96 9 �����݂ł́A1.9.16p2 ���ŐV�̃����[�X�o�[�W�����̂悤�ł��B
���{��̉�����Ƃ��Ă͈ȉ��̂悤�Ȃ�̂�����܂��B������������
1.9.15p8 ��x�[�X�ɏ����Ă���܂��̂ŁA1.9.16p2 �łׂ͍��ȕ������ς�
�Ă��܂��B���� nmbd �̈����������ԕς��Ă���̂ŁAman nmbd ���Ă���
���Ƃ�������߂��܂��B
o Unix Magazine '96 3 ���� �w���W PC UNIX�x���R���F�A�ЎR�P��
o Unix User '96 10 �����` �w�v���C�E�p�[�\�i�� Linux�x�^��h�m
o �w����t�� Samba �̎g�����x���� ��
<
ftp://etlport.etl.go.jp/pub/windows/knowhow/samba.txt>
����� Samba �h�L�������g�Ƃ��Ă̓o�C�u���I���݂ƌ����܂��傤�B
o �������D����� Samba Web �y�[�W
smb.conf �̖|��Ȃǂ�����܂��B
�j���[�X�ł́A�p��ł��� comp.protocols.smb �� Samba �Ɋւ���c�_����
��Ă��܂��B
==�I==
3. �C���X�g�[��
�ŐV�� Samba �̃\�[�X�� <
ftp://nimbus.anu.edu.au/pub/tridge/samba/> ��
�瓾���܂��B
Redhat ��g���Ă���l�Ȃ� Samba �� rpm �`���ŃC���X�g�[�����邱�Ƃ��
���܂��B���̔z�z�p�b�P�[�W�ɂ� Samba �̃o�C�i���C���X�g�[�����\�Ȃ�
�̂�����܂��B
===��===
���{��̃t�@�C������L���ɂ������ꍇ�́A�R���p�C���̍ۂ� Makefile �ł�
�ݒ肪�K�v�ɂȂ�܂��B��L�̂悤�ȃo�C�i���p�b�P�[�W�œ��{��t�@�C����
���L���ɂȂ��Ă��邩�ǂ����A�����m�̕����������Ⴂ�܂������҂܂ł�
�m�点����������K���ł��B
==�I==
Samba �𗘗p���邽�߂ɂ͈ȉ��� 2 �̃f�[�����v���O�������K�v�ł��B��
���͒ʏ� /usr/sbin �ɃC���X�g�[������A�V�X�e���N�����Ƀu�[�g�A�b�v
�X�N���v�g�ŋN������邩�A�܂��� inetd �����s����܂��B�X�N���v�g��
��́A``�f�[������N������'' �̐߂ɂ����Ă���܂��B
smbd
SMB �f�[�����ł��B
nmbd
�N���C�A���g�� NetBIOS �ɂ�閼�O��@�\����܂��B
�ȉ��� Samba �v���O�����͒ʏ� /usr/bin �ɃC���X�g�[������܂��i���̏�
���͑I��\�ł��j�B
smbclient
UNIX �z�X�g�̂��߂� SMB �N���C�A���g�v���O����
smbprint
SMB �z�X�g�̃v�����^�𗘗p���邽�߂̃X�N���v�g
smbprint.sysv
SVR4 �p�� smbprint
smbstatus
���[�J���z�X�g�ւ� SMB �ڑ���X�g����v���O����
smbrun
SMB �z�X�g�ŕK�v�ȃA�v���P�[�V������s�����邽�߂̕⏕�I�Ȗ�
���X�N���v�g�v���O����
����ɁA���� HOWTO �����ɂ� print �Ƃ������O�̃X�N���v�g�������Ă���
���B����� smbprint �X�N���v�g�̃t�����g�G���h�ŁA�����ȒP�ɂ���
��̂ł��B
Samba �̃p�b�P�[�W��C���X�g�[������̂͊ȒP�ł��B��L�� URL ����\�[
�X���ɓ���A�z�z�A�[�J�C�u�̒��� README �t�@�C����Ă��������B�܂�
docs/INSTALL.txt �ɂ̓C���X�g�[���菇�̏ڍׂȉ�������Ă���܂��B
�C���X�g�[���ɑ����āA�f�[������ /usr/sbin �ցA�v���O������ /usr/bin
�ցAman �y�[�W�� /usr/local/man �ɒu���܂��傤�B
Samba �̃p�b�P�[�W����Ƃ��Asmbd �̃R���t�B�M�����[�V�����t�@�C����
���� smb.conf �̒u���ꏊ�� Makefile �̒��Ŏw�肵�܂��B�D���ȂƂ���ɒu
�����Ƃ��ł��܂����A�ʏ�� /etc/smb.conf ���ǂ��ł��傤�B���O�t�@�C��
�ƃ��b�N�f�B���N�g���ɂ��Ă͈ȉ��̂悤�ɐݒ肵�Ă������Ƃ���߂���
���B
______________________________________________________________________
log file=/var/log/samba-log.%m
lock directory = /var/lock/samba
______________________________________________________________________
===��===
Samba �p�b�P�[�W�̃f�t�H���g�̐ݒ�ł́A�f�[��������уv���O������
/usr/local/samba/bin �ցA�܂� smb.conf �Ȃǂ� /usr/local/samba/lib ��
�u����܂��B
�܂� log file �� lock directory �̐ݒ�� Makefile �ł�ł��܂�
���Asmb.conf �ɏ����Ă��������h�L�������g���������Ȃ�̂ŗǂ��Ǝv����
���B
==�I==
smb.conf ��C���X�g�[�����܂��BSamba �̃v���O������R���p�C�������f�B
���N�g���ɍs���A����� example/simple �f�B���N�g���Ɉړ����� README ��
�ǂ�ʼn������B�����ăf�B���N�g���ɂ��� smb.conf �� /etc �ɃR�s�[����
���B�����ł����ƒ��ӁB Redhat �Ȃǂ̔z�z�p�b�P�[�W���� Samba ��C��
�X�g�[�������ꍇ�ɂ́A���� /etc �� smb.conf �����邩����܂���B����
�ꍇ�́A���̃t�@�C������ݒ��͂��߂�Ɨǂ��ł��傤�B
% smb.conf �� /etc �ɒu�������Ȃ��ꍇ�ɂ́A�D���ȏꏊ�ɂ����ăV���{
���b�N�����N�� /etc �ɍ��܂��傤�B
______________________________________________________________________
ln -s /path/to/smb.conf /etc/smb.conf
______________________________________________________________________
4. �f�[������N������
SMB �̃f�[������ /usr/sbin/smbd �� /usr/sbin/nmbd �� 2 �ł��B
Samba �̃f�[������s�����肩���� 2 ����܂��Binetd ����N������
���@�ƁA�X�^���h�A���[���̃v���Z�X�Ƃ��ċN�������@�ł��B��p�̃t�@�C
���T�[�o�Ƃ��ėp����ꍇ�� inetd ����N���������ǂ��ł��傤�B������
��Ή��炩�̗��R�ł����̃f�[�����v���Z�X������ł�A���̃��N�G�X�g��
���čĎ��s����܂��BSMB �T�[�o�T�[�r�X��X�������p���Ȃ��i�V�X�e��
�Ǘ��̂Ƃ������Ƃ��j�Ȃ�A/etc/rc.d/init.d �X�N���v�g�����s�����
�ǂ��ł��傤�B�K�v�ȂƂ������蓮�Ŏ��s���Ă�ǂ��ł��傤�B
===��===
�X�s�[�h�̓_����́A�f�[�����v���Z�X�̕����킸���Ȃ���L���Ƃ����ӌ���
����܂��B�܂��A��҂̃z�X�g�� 3 �����ق� Samba ��g�p�����ԁA��������
�Ƃ͂���܂���ł����B
==�I==
inetd ����f�[������N������ꍇ�́A�ȉ��̍s�� inetd �̐ݒ�t�@�C��
/etc/inetd.conf �ɉ����܂��B
______________________________________________________________________
# SAMBA NetBIOS services (for PC file and print sharing)
netbios-ssn stream tcp nowait root /usr/sbin/smbd smbd
netbios-ns dgram udp wait root /usr/sbin/nmbd nmbd
______________________________________________________________________
������������A�ȉ��̃R�}���h��s���� inetd ��X�^�[�g���܂��B
______________________________________________________________________
kill -HUP <pid of inetd>
______________________________________________________________________
<pid of inetd> �ɂ� inetd �̃v���Z�X ID ���Ă��������Bps �R�}���h
�Ŋm�F���邩�A"cat /var/run/inetd.pid" �Ȃǂł�킩��܂��B
�f�[������V�X�e���̋N���X�N���v�g�����s����ꍇ�́A�ȉ��̓�e��
/etc/rc.d/init.d/smb �Ƃ��č쐻���A�X�N���v�g���̃R�����g�Ŏw�肳���
����t�@�C���ւ̃V���{���b�N�����N����Ă��������B
______________________________________________________________________
#!/bin/sh
#
# /etc/rc.d/init.d/smb - starts and stops SMB services.
#
# The following files should be synbolic links to this file:
# symlinks: /etc/rc.d/rc1.d/K35smb (Kills SMB services on shutdown)
# /etc/rc.d/rc3.d/S91smb (Starts SMB services in multiuser mode)
# /etc/rc.d/rc6.d/K35smb (Kills SMB services on reboot)
#
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0
# See how we were called.
case "$1" in
start)
echo -n "Starting SMB services: "
daemon smbd -D
daemon nmbd -D
echo
touch /var/lock/subsys/smb
;;
stop)
echo -n "Shutting down SMB services: "
killproc smbd
killproc nmbd
rm -f /var/lock/subsys/smb
echo ""
;;
*)
echo "Usage: smb {start|stop}"
exit 1
esac
______________________________________________________________________
===��===
Slackware �̏ꍇ�́A/etc/rc.d/rc.local �Ɉȉ��̂悤�ȍs��lj����Ă���
�Ηǂ��ł��傤�B
______________________________________________________________________
if [ -f /usr/sbin/nmbd ]; then
echo "SAMBA servers"
/usr/sbin/smbd -D
/usr/sbin/nmbd -D
fi
______________________________________________________________________
==�I==
5. /etc/smb.conf �̐ݒ�
Linux �ł��� Unix ��ł�ASamba �̐ݒ�� /etc/smb.conf �Ƃ����t�@�C
���ɂ܂Ƃ߂ċL����Ă��܂��B�ǂ̃V�X�e�����\�[�X��J���邩�A�܂�����
��ɂǂ̂悤�Ȑ�����Ȃ����Ȃǂ́A���̃t�@�C���Őݒ肵�܂��B
���̐߂ɑ��� 2 �߂ł� Linux �̃h���C�u��v�����^�� Windows �}�V������
���L�����@�ɂ��ďq�ׂ܂��B���̐߂Ŏ��� smb.conf �́A�ł��邾���ȒP
�ɂ����̋@�\�������悤�ɏ�������̂ł��̂ŁA�����܂œ����I�Ȃ��
�ƍl���Ă��������B
���� smb.conf �̏ڍׂ����Ȃ��Ă�S�z����K�v�͂���܂���B�d�v�ȊT�O
�ɂ��Ă͌�̐߂ł��炽�߂Đ����܂��B
smb.conf ���̊e�X�̃Z�N�V�����́A�Z�N�V�����w�b�_�i[global]�A[homes]�A
[printers] ���j����n�܂�܂��B
global �Z�N�V�����ł͑S�ẴZ�N�V�����ɋ��ʂȕϐ���w�肵�܂��B
homes �Z�N�V������w�肷��ƁA�����[�g���[�U�͎����̃z�[���f�B���N�g��
�փA�N�Z�X�ł���悤�ɂȂ�܂��B�܂� Samba �z�X�g�ł��� Linux �}�V��
�ɃA�J�E���g����Ă���l�� Windows �}�V���Őڑ�����ƁA�ނ�l�l
�̃z�[���f�B���N�g���𗘗p�ł���悤�ɂȂ�܂��B���̃T�[�r�X�𗘗p����
�ɂ� Linux �}�V���ɃA�J�E���g����Ă��Ȃ���Ȃ�܂���B
�����Ɏ����� smb.conf �̗�ł́A�����[�g���[�U�������̃z�[���f�B���N�g
���ɃA�N�Z�X���A/tmp �f�B���N�g���ɏ������݂ł���悤�ɂ��Ă���
���BWindows ���[�U�ɂ����̃��\�[�X�����ɂ́ALinux �̃z�X�g�����[
�J���ȃl�b�g���[�N��ɂȂ���Ȃ�܂���BWindows �̃t�@�C���}�l�[�W��
��G�N�X�v���[����p����A�����̃h���C�u��l�b�g���[�N�h���C�u�Ƃ�
�Đڑ��ł��܂��B
���̕����̈ȉ��̐߂ł́A���̃��\�[�X��L�����邽�߂� smb.conf �t�@�C
���̏����ɂ��Ă�q�ׂĂ��܂��B�Q�l�ɂ��Ă��������B
______________________________________________________________________
; /etc/smb.conf
;
; Make sure and restart the server after making changes to this file, ex:
; /etc/rc.d/init.d/smb stop
; /etc/rc.d/init.d/smb start
[global]
; Uncomment this if you want a guest account
; guest account = nobody
log file = /var/log/samba-log.%m
lock directory = /var/lock/samba
share modes = yes
[homes]
comment = Home Directories
browseable = no
read only = no
create mode = 0750
[tmp]
comment = Temporary file space
path = /tmp
read only = no
public = yes
______________________________________________________________________
6. Linux �̃h���C�u�� Windows �}�V�����狤�L����
��ɂ������ȒP�� smb.conf �������悤�ɁALinux �̃h���C�u�� Windows
�̃��[�U�����L����̂͊ȒP�ł��B������ Samba �̃V�X�e���ł͔��ɑ���
�̍��ڂ�J�X�^�}�C�Y�ł��܂��B�ȉ��ɂ����������܂��B
����f�B���N�g���𐧌��Ȃ��Ɍ��J����ɂ́A���̐߂ŋ�����smb.conf ��
tmp �Z�N�V������܂˂��āA�������̃p�����[�^��ݒ肵�܂��B
______________________________________________________________________
[public]
comment = Public Stuff
path = /home/public
public = yes
writable = yes
printable = yes
______________________________________________________________________
���̃f�B���N�g���̐�������ƕς��āA�ǂݏo���͂���ł�\�Ƃ��A��
�����݂� staff �O���[�v�̃��[�U�Ɍ���ɂ́A�ȉ��̂悤�ɂ��܂��B
______________________________________________________________________
[public]
comment = Public Stuff
path = /home/public
public = yes
writable = yes
printable = no
write list = @staff
______________________________________________________________________
�h���C�u���L�Ɋւ��鑼�̎�@�ɂ��ẮASamba �t���̕����� man �y�[�W
����������B
===��===
Win 95 �ō쐬�����t�@�C���ő啶���������̋�ʂ����A���{��𐳂���
�\�������邽�߂ɂ́Aglobal �Z�N�V�����Ɉȉ��̃G���g����lj����Ă�����
�ǂ��悤�ł��B
______________________________________________________________________
mangle case = no
case sensitive = no
default case = upper
preserve case = yes
short preserve case = yes
______________________________________________________________________
���{��𗘗p����ɂ́A�R���p�C������ Makefile ��
-DKANJI=\"euc\"
�ȂǂƎw�肷��K�v������܂��B�܂� 1.9.16p2 ����́Asmb.conf ��
______________________________________________________________________
coding system = <�R�[�h�n>
______________________________________________________________________
�̂悤�Ɏw�肷�邱�Ƃ��\�ɂȂ�A�܂� CAP �Ɠ����Ɏg�����߂� "cap" ��
���������R�[�h�n���lj�����܂����B
�Ȃ��R�[�h�n�� unicode �ɂ��Ă����ƁA���{�� Windows 95 ���� Samba �̃h
���C�u��ڑ������ꍇ�A�V�K�t�H���_�̍쐬���ł��Ȃ��Ȃ�Ƃ����s�����
�邻���ł��B
==�I==
7. Windows �̃h���C�u�� Linux �}�V���ŋ��L����
Samba �̔z�z�p�b�P�[�W�ɂ́AUnix �}�V���̂��߂� SMB �N���C�A���g�v���O
�������܂܂�Ă��܂��B���̃v���O������ ftp �̂悤�ȃR�}���h�w���̃C��
�^�[�t�F�[�X����Ă��܂��B���̃v���O������g���AWindows �̃T�[�o
�ƁA Linux �̃N���C�A���g�Ƃ̂������ŁA�t�@�C���̂���肪�ł��܂��B
===��===
2.0 �ȏ�Ȃǂ̍ŋ߂̃J�[�l���ł� smbfs �Ƃ����t�@�C���V�X�e������
��ANT �Ȃǂ̃l�b�g���[�N�h���C�u�ڃ}�E���g�ł���悤�ł��B�ڍ�
�́A�J�[�l���f�B���N�g���� Documentation/filesystems/smbfs.txt ���
�������B
==�I==
����z�X�g�łǂ�ȋ��L�T�[�r�X�����p�o���邩�ׂ邽�߂ɂ́A�ȉ��̂�
���ȃR�}���h��s���܂��B
______________________________________________________________________
/usr/sbin/smbclient -L host
______________________________________________________________________
host �ɂ͒��ׂ����z�X�g�̖��O���܂��B���̃R�}���h��s����ƁA�T
�[�r�X���̃��X�g�������܂��B�T�[�r�X���Ƃ́A���Ȃ������̃z�X�g�ŗ��p
�ł���h���C�u��v�����^�̖��O�ł��B�� SMB �T�[�o�ɉ��炩�̃Z�L����
�e�B�������������Ă���ƃp�X���[�h����܂��̂ŁAguest �A�J�E���g��
�p�X���[�h���A���̃z�X�g�ł̂��Ȃ��̌l�A�J�E���g�̃p�X���[�h����
�������B
���s�����܂��B
______________________________________________________________________
smbclient -L zimmerman
______________________________________________________________________
���s���ʂ͈ȉ��̂悤�ɂȂ�ł��傤�B
______________________________________________________________________
Server time is Sat Aug 10 15:58:27 1996
Timezone is UTC+10.0
Password:
Domain=[WORKGROUP] OS=[Windows NT 3.51] Server=[NT LAN Manager 3.51]
Server=[ZIMMERMAN] User=[] Workgroup=[WORKGROUP] Domain=[]
Sharename Type Comment
--------- ---- -------
ADMIN$ Disk Remote Admin
public Disk Public
C$ Disk Default share
IPC$ IPC Remote IPC
OReilly Printer OReilly
print$ Disk Printer Drivers
This machine has a browse list:
Server Comment
--------- -------
HOPPER Samba 1.9.15p8
KERNIGAN Samba 1.9.15p8
LOVELACE Samba 1.9.15p8
RITCHIE Samba 1.9.15p8
ZIMMERMAN
______________________________________________________________________
�u���E�Y���X�g�ibrowse list�j�́A�l�b�g���[�N��̑��� SMB �T�[�o�̋��L
���\�[�X�������̂ł��B
�N���C�A���g�Ƃ��ė��p����ɂ͈ȉ��̂悤�Ɏ��s���܂��B
______________________________________________________________________
/usr/sbin/smbclient service <password>
______________________________________________________________________
service �ɂ̓z�X�g���Ƌ��L����w�肵�܂��B�z�X�g zimmerman �ɂ�����
public �Ƃ������O�Ō��J����Ă���f�B���N�g���𗘗p���邽�߂�
�́Aservice �� \\zimmerman\public �ƂȂ�܂��B�V�F���̃v�����v�g���炱
�̃R�}���h�𗘗p����ꍇ�́A�o�b�N�X���b�V����G�X�P�[�v���Ȃ��Ƃ�����
����A���ǎ��̂悤�ɓ��͂���K�v������܂��B
______________________________________________________________________
/usr/sbin/smbclient \\\\zimmerman\\public mypasswd
______________________________________________________________________
mypassword �ɂ́A���Ȃ��� �p�X���[�h��̂܂����Ă��������B
===��===
�ȉ��͏��{������l�Ԋ�����ɂ��������ƊȒP�ȓ��͕��@�ł��B
______________________________________________________________________
/usr/sbin/smbclient '\\zimmerman\public' mypasswd
______________________________________________________________________
==�I==
�ȉ��̂悤�� smbclient �̃v�����v�g���o�Ă��܂��B
______________________________________________________________________
Server time is Sat Aug 10 15:58:44 1996
Timezone is UTC+10.0
Domain=[WORKGROUP] OS=[Windows NT 3.51] Server=[NT LAN Manager 3.51]
smb: \>
______________________________________________________________________
h �ƑłĂAsmbclient �̃w���v�������܂��B
______________________________________________________________________
smb: \> h
ls dir lcd cd pwd
get mget put mput rename
more mask del rm mkdir
md rmdir rd prompt recurse
translate lowercase print printmode queue
cancel stat quit q exit
newer archive tar blocksize tarmode
setmode help ? !
smb: \>
______________________________________________________________________
ftp ��g����l�Ȃ�Aman �y�[�W���܂ł�Ȃ� smbclient ���g����悤
�ɂȂ�ł��傤�B
8. Linux �}�V���̃v�����^�� Windows �}�V�����痘�p����
Linux �̃v�����^�� Windows ���痘�p����ɂ́ALinux ��Ńv�����^������
��Ɠ��삷��悤�ɐ������ݒ肳��Ă���K�v������܂��BLinux �ł̃v����
�g���ł��Ă���� SMB �ł̋��L�͊ȒP�ł��B
���[�J���v�����^�̐ݒ�ɂ��Ă� Printing HOWTO ��݂Ă��������B
�M�Ҏ��g�� Windows NT �ɐڑ�����Ă���v�����^��g���Ă���̂ŁA���̐�
�ɏ����Ă��邱�Ƃ͐�ɐ������Ƃ͌���܂���B�������x�ɎƂ߂Ă���
�Ă��������B����̓I�Ȏg�p�o������Ă������������Ⴂ�܂�����A
�ǂ���
[email protected] �܂Œm�点�Ă��������B����������̏͂̓�
�e����ł��܂��B
smb.conf �Ƀv�����^�̐ݒ����܂��B
______________________________________________________________________
[global]
printing = bsd
printcap name = /etc/printcap
load printers = yes
log file = /var/log/samba-log.%m
lock directory = /var/lock/samba
[printers]
comment = All Printers
security = server
path = /var/spool/lpd/lp
browseable = no
printable = yes
public = yes
writable = no
create mode = 0700
[ljet]
security = server
path = /var/spool/lpd/lp
printer name = lp
writable = yes
public = yes
printable = yes
print command = lpr -r -h -P %p %s
______________________________________________________________________
�v�����^�̃Z�N�V�����ɂ����� path �ɂ́A/etc/printcap �Őݒ肵���X�v�[
���f�B���N�g���Ɠ����f�B���N�g����w�肵�Ă��������B
����: Samba ��g���� Unix �}�V���̃v�����^�� Windows NT �}�V�����狤�L
������ۂɂ͖��_������������܂��B���̂����̈�́ANT ����͋��L
�v�����^�������������Ȃ��Ƃ�����̂ł��B���̖�������ɂ� Samba
�z�z�p�b�P�[�W�� docs/WinNT.txt �t�@�C����Q�Ƃ��ĉ������B�p�X���[�h��
�ւ��������܂��B������̕��͓��t�@�C����Ă�A���炢�炷�邾��
�ʼn�ɂ͂Ȃ�܂���...
===��===
��҂� Linux �ɂȂ����Ă��� Epson MJ-700V2C �� Samba �Ō��J��
Windows 95 ����g���Ă��܂��̂ŁA���̐ݒ��e��ȉ��ɋL���܂��B����
���A���J��̓v���C�x�[�g�A�h���X�̂����l�b�g���[�N�Ȃ̂ŁA��{�I�ɃZ
�L�����e�B�̂��Ƃ͍l���Ă��܂���B
�܂� smb.conf �ł��B
______________________________________________________________________
[global]
lock directory = /var/locks/samba
workgroup = WORKGROUP
browseable = yes
allow hosts = 192.168.111.
printing = bsd
load printers = no
printcap name = /etc/printcap
password level = 8
create mode = 0750
mangle case = no
case sensitive = no
default case = upper
preserve case = yes
short preserve case = yes
[lp]
comment = MJ-700V2C
printer name = lp
path = /var/tmp
printable = yes
writable = yes
create mode = 0700
______________________________________________________________________
/etc/printcap �ł��B
______________________________________________________________________
lp:\
:lp=/dev/lp1:\
:sd=/var/spool/lpd/lp:\
:lf=/var/spool/lpd/lp/errs:\
:if=/var/spool/lpd/lp/incat:\
:mx#0:\
:sh:\
:sf:
______________________________________________________________________
�C���v�b�g�t�B���^�� /var/spool/lpd/lp/incat �ł��B
______________________________________________________________________
#!/bin/sh
/bin/cat
exit 0
______________________________________________________________________
Windows 95 ����́A�l�b�g���[�N�h���C�u��I����� MJ-700V2C �̃h���C
�o���őI��ŃC���X�g�[������K�v������܂��B
==�I==
9. Linux �}�V������ Windows �̃v�����^��g��
Windows �}�V����̃v�����^��L���邽�߂ɂ͈ȉ��̍�Ƃ��K�v�ł��B
1. /etc/printcap �ɐ������G���g�����K�v�ŁA�����̓��[�J���ȃf�B���N
�g���\���ɏ�������̂ł���K�v������܂��i�X�v�[���f�B���N�g���̐�
��Ȃǁj�B
2. /usr/bin/smbprint �X�N���v�g���K�v�ł��B����� Samba �̃\�[�X�p�b�P
�[�W�ɕt���Ă��܂����ASamba �̃o�C�i���z�z�p�b�P�[�W�ɂ͕t���Ă���
��������܂���B��ŃI���W�i����X�C��������̂�ڂ��܂��B
3. ASCII �t�@�C���� Postscript �`���ɕϊ�����K�v������ꍇ�ɂ́A
nenscript �Ȃǂ� Postscript �R���o�[�^�������K�v������܂��B
nenscript �͒ʏ�� /usr/bin �ɃC���X�g�[������Ă��܂��B
4. Samba �𗘗p�������e�Ղɂ��Ă����悤�ȃt�����g�G���h���~����
��A�ȉ��ɋL�����ȒP�� perl �X�N���v�g����ĉ������BASCII�A
Postscript�Acreated Postscript ��������悤�ɂȂ��Ă��܂��B
�ȉ��ɋL���̂́AWindows NT �v�����^�ɐڑ����ꂽ HP 5MP �v�����^�𗘗p
���邽�߂� /etc/printcap �ւ̃G���g���ł��B���ꂼ��̓�e�͈ȉ��̒ʂ�
�ł��B
cm �R�����g
lp �o�͂Ɏg���f�o�C�X��
sd ���̃v�����^�̂��߂̃X�v�[���f�B���N�g��
af �A�J�E���g�t�@�C��
mx �ő�̃t�@�C���T�C�Y�i0 �ɂ���Ζ������ɂȂ�܂��j
if ���͂ɗp������t�B���^�i�܂��̓X�N���v�g�j
����ɏ�K�v�Ȃ�APrinting HOWTO �� printcap �� man �y�[�W��ĉ�
�����B
______________________________________________________________________
# /etc/printcap
#
# //zimmerman/oreilly via smbprint
#
lp:\
:cm=HP 5MP Postscript OReilly on zimmerman:\
:lp=/dev/lp1:\
:sd=/var/spool/lpd/lp:\
:af=/var/spool/lpd/lp/acct:\
:mx#0:\
:if=/usr/bin/smbprint:
______________________________________________________________________
�X�v�[���f�B���N�g���ƃA�J�E���g�t�@�C�������݂��Ă���A�������݉\��
���邱�Ƃ�m�F���Ă����ĉ������B�܂� printcap �� if �s�ɁA�ȉ��ɋL��
smbprint �X�N���v�g�ւ̐������p�X���ݒ肳��Ă��邱�ƁA lp �s�� /dev
�f�B���N�g���ɂ��鐳�����f�o�C�X���ݒ肳��Ă��邱�Ƃ�m�F���ĉ������B
���� smbprint �ł��B����͒ʏ� /usr/bin �ɒu����Ă���A Samba ���
�� Andrew Tridgell �{�l�ɂ��ď����ꂽ��̂ł��i�M�҂̒m��Ȃ� Samba
�̋���҂����ɂ����������炷�݂܂���j�B����� Samba �̃\�[�X�p�b
�P�[�W�ɓ����Ă��܂����A�o�C�i���z�z�̏ꍇ�ɂ͖�������m��܂���̂ŁA
�ȉ��Ɏ������X��������̂���Ă����܂��B
�ȉ��ɋL�����X�N���v�g�𒍈Ӑ[�����ĉ������B����̓I���W�i����C������
��̂ŁA�����g���₷���Ȃ��Ă���Ǝv���܂��B
______________________________________________________________________
#!/bin/sh -x
# This script is an input filter for printcap printing on a unix machine. It
# uses the smbclient program to print the file to the specified smb-based
# server and service.
# For example you could have a printcap entry like this
#
# smb:lp=/dev/null:sd=/usr/spool/smb:sh:if=/usr/local/samba/smbprint
#
# which would create a unix printer called "smb" that will print via this
# script. You will need to create the spool directory /usr/spool/smb with
# appropriate permissions and ownerships for your system.
# Set these to the server and service you wish to print to
# In this example I have a WfWg PC called "lapland" that has a printer
# exported called "printer" with no password.
#
# Script further altered by
[email protected] (Michael Hamilton)
# so that the server, service, and password can be read from
# a /usr/var/spool/lpd/PRINTNAME/.config file.
#
# In order for this to work the /etc/printcap entry must include an
# accounting file (af=...):
#
# cdcolour:\
# :cm=CD IBM Colorjet on 6th:\
# :sd=/var/spool/lpd/cdcolour:\
# :af=/var/spool/lpd/cdcolour/acct:\
# :if=/usr/local/etc/smbprint:\
# :mx=0:\
# :lp=/dev/null:
#
# The /usr/var/spool/lpd/PRINTNAME/.config file should contain:
# server=PC_SERVER
# service=PR_SHARENAME
# password="password"
#
# E.g.
# server=PAULS_PC
# service=CJET_371
# password=""
#
# Debugging log file, change to /dev/null if you like.
#
logfile=/tmp/smb-print.log
# logfile=/dev/null
#
# The last parameter to the filter is the accounting file name.
#
spool_dir=/var/spool/lpd/lp
config_file=$spool_dir/.config
# Should read the following variables set in the config file:
# server
# service
# password
# user
eval `cat $config_file`
#
# Some debugging help, change the >> to > if you want to same space.
#
echo "server $server, service $service" >> $logfile
(
# NOTE You may wish to add the line `echo translate' if you want automatic
# CR/LF translation when printing.
echo translate
echo "print -"
cat
) | /usr/bin/smbclient "\\\\$server\\$service" $password -U $user -N -P >> $log
file
______________________________________________________________________
�قƂ�ǂ� Linux �p�b�P�[�W�ɂ́AASCII ������ Postscript �ɂ���
nenscript �R�}���h���܂܂�Ă��܂��B�ȉ��� perl �X�N���v�g�́A
smbprint ��g���Ĉ����ۂɁA���V���v���ȃC���^�[�t�F�[�X���
���̂ł��B
______________________________________________________________________
Usage: print [-a|c|p] <filename>
-a prints <filename> as ASCII
-c prints <filename> formatted as source code
-p prints <filename> as Postscript
If no switch is given, print attempts to
guess the file type and print appropriately.
______________________________________________________________________
smbprint ��g���� ASCII �t�@�C��������ƁA�����s�͉��s����Ă��܂�
�܂��B���̃X�N���v�g�ł́A�\�Ȍ���P��̓r���ł͂Ȃ��A�ʼn��s����
�悤�ɂ��Ă��܂��B
�\�[�X�R�[�h�̃t�H�[�}�b�g�ɂ� nenscript ��p���Ă��܂��BASCII �t�@�C
���� 2 �i�g�݂ɐ��`����A�w�b�_�i���t�A�t�@�C�����Ȃǁj�����܂��B��
�̃X�N���v�g�`�ɂ��āA���̐��`���@��p���邱�Ƃ�ł���ł��傤�B
Postscript �̕����͂��łɐ��`����Ă����̂Ƃ݂Ȃ��āA���̂܂ܒʂ���
���ɂȂ��Ă��܂��B
______________________________________________________________________
#!/usr/bin/perl
# Script: print
# Authors: Brad Marshall, David Wood
# Plugged In Communications
# Date: 960808
#
# Script to print to oreilly which is currently on zimmerman
# Purpose: Takes files of various types as arguments and
# processes them appropriately for piping to a Samba print script.
#
# Currently supported file types:
#
# ASCII - ensures that lines longer than $line_length characters wrap on
# whitespace.
# Postscript - Takes no action.
# Code - Formats in Postscript (using nenscript) to display
# properly (landscape, font, etc).
#
# Set the maximum allowable length for each line of ASCII text.
$line_length = 76;
# Set the path and name of the Samba print script
$print_prog = "/usr/bin/smbprint";
# Set the path and name to nenscript (the ASCII-->Postscript converter)
$nenscript = "/usr/bin/nenscript";
unless ( -f $print_prog ) {
die "Can't find $print_prog!";
}
unless ( -f $nenscript ) {
die "Can't find $nenscript!";
}
&ParseCmdLine(@ARGV);
# DBG
print "filetype is $filetype\n";
if ($filetype eq "ASCII") {
&wrap($line_length);
} elsif ($filetype eq "code") {
&codeformat;
} elsif ($filetype eq "ps") {
&createarray;
} else {
print "Sorry..no known file type.\n";
exit 0;
}
# Pipe the array to smbprint
open(PRINTER, "|$print_prog") || die "Can't open $print_prog: $!\n";
foreach $line (@newlines) {
print PRINTER $line;
}
# Send an extra linefeed in case a file has an incomplete last line.
print PRINTER "\n";
close(PRINTER);
print "Completed\n";
exit 0;
# --------------------------------------------------- #
# Everything below here is a subroutine #
# --------------------------------------------------- #
sub ParseCmdLine {
# Parses the command line, finding out what file type the file is
# Gets $arg and $file to be the arguments (if the exists)
# and the filename
if ($#_ < 0) {
&usage;
}
# DBG
# foreach $element (@_) {
# print "*$element* \n";
# }
$arg = shift(@_);
if ($arg =~ /\-./) {
$cmd = $arg;
# DBG
# print "\$cmd found.\n";
$file = shift(@_);
} else {
$file = $arg;
}
# Defining the file type
unless ($cmd) {
# We have no arguments
if ($file =~ /\.ps$/) {
$filetype = "ps";
} elsif ($file =~ /\.java$|\.c$|\.h$|\.pl$|\.sh$|\.csh$|\.m4$|\.inc$|\.html$|\.htm$/) {
$filetype = "code";
} else {
$filetype = "ASCII";
}
# Process $file for what type is it and return $filetype
} else {
# We have what type it is in $arg
if ($cmd =~ /^-p$/) {
$filetype = "ps";
} elsif ($cmd =~ /^-c$/) {
$filetype = "code";
} elsif ($cmd =~ /^-a$/) {
$filetype = "ASCII"
}
}
}
sub usage {
print "
Usage: print [-a|c|p] <filename>
-a prints <filename> as ASCII
-c prints <filename> formatted as source code
-p prints <filename> as Postscript
If no switch is given, print attempts to
guess the file type and print appropriately.\n
";
exit(0);
}
sub wrap {
# Create an array of file lines, where each line is < the
# number of characters specified, and wrapped only on whitespace
# Get the number of characters to limit the line to.
$limit = pop(@_);
# DBG
#print "Entering subroutine wrap\n";
#print "The line length limit is $limit\n";
# Read in the file, parse and put into an array.
open(FILE, "<$file") || die "Can't open $file: $!\n";
while(<FILE>) {
$line = $_;
# DBG
#print "The line is:\n$line\n";
# Wrap the line if it is over the limit.
while ( length($line) > $limit ) {
# DBG
#print "Wrapping...";
# Get the first $limit +1 characters.
$part = substr($line,0,$limit +1);
# DBG
#print "The partial line is:\n$part\n";
# Check to see if the last character is a space.
$last_char = substr($part,-1, 1);
if ( " " eq $last_char ) {
# If it is, print the rest.
# DBG
#print "The last character was a space\n";
substr($line,0,$limit + 1) = "";
substr($part,-1,1) = "";
push(@newlines,"$part\n");
} else {
# If it is not, find the last space in the
# sub-line and print up to there.
# DBG
#print "The last character was not a space\n";
# Remove the character past $limit
substr($part,-1,1) = "";
# Reverse the line to make it easy to find
# the last space.
$revpart = reverse($part);
$index = index($revpart," ");
if ( $index > 0 ) {
substr($line,0,$limit-$index) = "";
push(@newlines,substr($part,0,$limit-$index)
. "\n");
} else {
# There was no space in the line, so
# print it up to $limit.
substr($line,0,$limit) = "";
push(@newlines,substr($part,0,$limit)
. "\n");
}
}
}
push(@newlines,$line);
}
close(FILE);
}
sub codeformat {
# Call subroutine wrap then filter through nenscript
&wrap($line_length);
# Pipe the results through nenscript to create a Postscript
# file that adheres to some decent format for printing
# source code (landscape, Courier font, line numbers).
# Print this to a temporary file first.
$tmpfile = "/tmp/nenscript$$";
open(FILE, "|$nenscript -2G -i$file -N -p$tmpfile -r") ||
die "Can't open nenscript: $!\n";
foreach $line (@newlines) {
print FILE $line;
}
close(FILE);
# Read the temporary file back into an array so it can be
# passed to the Samba print script.
@newlines = ("");
open(FILE, "<$tmpfile") || die "Can't open $file: $!\n";
while(<FILE>) {
push(@newlines,$_);
}
close(FILE);
system("rm $tmpfile");
}
sub createarray {
# Create the array for postscript
open(FILE, "<$file") || die "Can't open $file: $!\n";
while(<FILE>) {
push(@newlines,$_);
}
close(FILE);
}
______________________________________________________________________
===��===
nenscrpt �͓��{���ʂ��܂��AJE �ɂ� psconv �Ƃ������{��ɑΉ�����
�R�}���h�������Ă��܂��B���ɂ� a2ps�Aps2ascii�A ps2txt�AtoPS �ȂǗl�X
�Ȃ�̂��l�b�g���[�N������\�ł��B
�Ȃ��A��҂͂��̏͂̃X�N���v�g��e�X�g�ł����������܂���̂ŁA����
�ɂ������X�N���v�g��̂܂܍ڂ��Ă����܂����B�������ē��{���ʂ�����
�ɐ����������́A���A��������K���ł��B
==�I==
10. ���쌠
���� HOWTO �����̒��쌠�� 1996 �N�ȍ~ David Wood �ɂ����̂Ƃ��܂��B
���̐߂̐錾��܂ނ��ׂĂ̕������ύX����Ȃ�����ɂ����āA������`��
�ւ̂��̕����̕����A����т��̍Ĕz�z����܂��B
11. �ӎ�
�����[���Ō�ӌ����������A���̔ł̃����[�X�̍ۂɁA���̐߂ł���
�O����Ċ��ӂ������Ǝv���܂��B
===��===
���{��ւ̖|��ɓ������ẮA
���{��K����
[email protected]
�K�� ������
[email protected]
���{���i����
[email protected]
���Y��j����
[email protected]
�Ɍ��̎w�E��L�v�ȃR�����g��������܂����B
==�I==