B
Bandit2004
Und noch ein Tutorial für Sie (Leider wieder auf English)
Quelle: http://fedoranews.org/krishnan/tutorial/samba/index.shtml
Autor: Krishnan Subramanian
============
Part 1: Installing Samba
Download the latest RPMs from http://us2.samba.org/samba/ftp/Binary_Packages/Fedora/RPMS/i386/core/2/.
You can alternately select any other mirrors from Samba Website.
Download the following RPMs from the nearest mirror.
samba-3.0.1-1.i386.rpm
samba-client-3.0.1-1.i386.rpm
samba-common-3.0.1-1.i386.rpm
samba-swat-3.0.1-1.i386.rpm
For the sake of explanation, let us assume that you save the files in /tmp/samba folder. Now this folder contains all the files needed for Samba installation including Samba client and swat (Samba Web Administration Tool)
Open a terminal window and login as root by using su command and entering the root password. If you are already logged in as root, skip this step and go to the next step.
[user@machinename samba]#su
Password:
If you are installing Samba for the first time, follow this step else skip this and go to the next step.
[root@machinename samba]# rpm -ivh samba-*.i386.rpm
warning: samba-3.0.1-1.i386.rpm: V3 DSA signature: NOKEY, key ID 2f87af6f
Preparing... ########################################### [100%]
1:samba-common ########################################### [ 25%]
2:samba ########################################### [ 50%]
3:samba-client ########################################### [ 75%]
4:samba-swat ########################################### [100%]
[root@machinename samba]#
You can safely ignore the warning right now. Information on the warning and taking care of it is beyond the scope of this tutorial. If you have Samba installed in the system, you can upgrade to the latest version by
[root@machinename samba]# rpm -Uvh samba-*.i386.rpm
Part 2: Configuring Samba
Now we will configure the Samba installation by editing the configuration file. The configuration file smb.conf is present in /etc/samba/. We will setup the configuration file to share the user's home directory and a public directory /tmp to share files among users.
[root@machinename samba]#cd /etc/samba
[root@machinename samba]#vi smb.conf
Under global settings,
[global]
workgroup = Myworkgroup
server string = Machinename Samba Server
This sets the workgroup name and the server string. You can assign the name of your workgroup and any server string you want to assign.
hosts allow = 192.168.1.
This is very important from the security point of view. You can set the hosts you want to allow here. In this example, all the hosts in the local area network with the IP addresses 192.168.1.* to access the Samba share.
security = user
In User Level Security, the client will send a session setup request directly following protocol negotiation. This request provides a username and password. The server can either accept or reject that username/password combination.
Under share definitions, you will see the following
[homes]
comment = Home Directories
browseable = no
writable = yes
This allows, for example, user joe to access his home directory from a windows machine or a Samba client.
[tmp]
comment = Temporary file space
path = /tmp
read only = no
public = yes
This allows access to /tmp directory in your Fedora machine from a windows machine or a Samba client.
Here we will digress a little bit to see the difference between [homes] and [tmp]. The [homes] option allows the users to access their respective home directories in the Fedora box. They can only access their own directory and not any other user's directory. This is not of much help if people want to share files with one another. So [tmp] option allows all users to share files in /tmp directory.
Save the file smb.conf and exit the editor.
Now we can test if the configuration is correct by using testparm.
[root@machinename samba]/usr/bin/testparm
Load smb config files from /etc/samba/smb.conf
Processing section "[homes]"
Processing section "[printers]"
Processing section "[tmp]"
Loaded services file OK.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions
Once you press enter, you should see something like this
# Global parameters
[global]
workgroup = Myworkgroup
server string = Machinename Samba Server
username map = /etc/samba/smbusers
log file = /var/log/samba/log.%m
max log size = 50
socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
dns proxy = No
hosts allow = 192.168.1.
[homes]
comment = Home Directories
read only = No
browseable = No
[printers]
comment = All Printers
path = /var/spool/samba
printable = Yes
browseable = No
[tmp]
comment = Temporary file space
path = /tmp/
read only = No
guest ok = Yes
This implies your configuration is ok and you are all set to start using Samba.You can also configure Samba so that members of a group can share files among themselves by using [groups] option in smb.conf file. This will be very helpful in an organization with different departments.
Part 3: Using Samba
Now that we have configured Samba, we can start using it. If you are upgrading from a previous version, you have to kill the Samba daemon (if it is running). To do this,
[root@machinename samba]killall smbd
[root@machinename samba]killall nmbd
Now we can start Samba with our new configuration by
[root@machinename samba]/usr/sbin/smbd -D
[root@machinename samba]/usr/sbin/nmbd -D
If you want to run Samba from xinetd instead, you can edit /etc/xinetd.conf and add the following lines
service netbios-ns
{
socket_type = dgram
protocol = udp
wait = yes
user = root
group = root
server = /usr/sbin/nmbd
}
service netbios-ssn
{
socket_type = stream
protocol = tcp
wait = no
user = root
group = root
server = /usr/sbin/smbd
}
Now we will test the Samba installation.
To test the Samba installation, we use the Samba client we installed. The -L netbios name switch tells smbclient to get a list of shares from the server specified by netbios name. I use the -N switch to suppress the prompting for a password because it is not needed to see just the shares that are available.
[root@machinename samba]# /usr/bin/smbclient -L localhost -N
Anonymous login successful
Sharename Type Comment
--------- ---- -------
tmp Disk Temporary file space
IPC$ IPC IPC Service (Machinename Samba Server)
ADMIN$ IPC IPC Service (Machinename Samba Server)
Anonymous login successful
Server Comment
--------- -------
Machinename Machinename Samba Server
Workgroup Master
--------- -------
Myworkgroup Machinename
The information given above may be different depending on your Samba configuration. The above example is based on the configuration file of a test machine. This is provided to give you an idea of what you will get when you try this. Having done this, we will now see how to use different clients to access Samba shares.
A brief description of how to access Samba share from different clients are given below. This is by no means exhaustive and if you want detailed explanation, you can refer to various articles available on this subject.
Windows 98
Windows 98 has built-in support for TCP/IP. But this is not installed as the default. To add TCP/IP, go to `Control Panel' --> `System' and choose `Add' --> `Protocols' --> `TCP/IP from Microsoft'. Be sure to enter your network address and network mask correctly. Reboot your windows 98 machine and the Samba share will be available in the Network Neighborhood. To use a printer on the samba server, you should install the printer driver from the corresponding Windows version
Windows 2000/XP
To map a drive using the Windows GUI, click on My Computer. On the toolbar options, select Map Network Drive (under Windows XP this option is under the Tools menu). Once selected, a new box will open up. In the Drive box, click a drive letter that you wish to use. In the Folder box, type the path for the server and path that you wish to connect to and click finish.
Alternately, you can use the following command from the command line
NET USE G: \\Machinename\tmp /YES
This will map the /tmp folder of your Fedora box to G drive.
Mac OS X
Make sure that SMB support is enabled in Directory Access Utility under Applications/Utilities. Activate Finder, select Go and then Connect to Server. In the server address field, type in the server address in one of the following formats.
smb://ServerName/ShareName/
smb://WORKGROUP@ServerName/ShareName
smb://WORKGROUP;User@ServerName/ShareName
Server address can be IP address or any valid DNS name. Please note that you will be unable to connect to any server that has a share name containing a hyphen or space in it. For spaces, you can try substituting a %20 in its place. After clicking Connect, you may be prompted for Authentication.
Linux If you are planning to install Samba in your Fedora box only, you can skip this section. But if you are going to mount Samba shares from any other linux box, you may continue reading.
Make sure that SAMBA_FS is compiled into your Kernel. If not, you will get the error message mount: fs type smbfs not supported by kernel when you try to mount the Samba share. If you get this message, recompile the kernel with SAMBA_FS. Now Samba must be installed in both the machines even if you are going to access Samba shares from only one machine. On your second machine, configure Samba with the --with-smbmount parameter. Using this option automatically creates the smbmount and smbumount commands along with the file /sbin/mount.smbfs (which is actually just a soft link to smbmount).
Now you can mount the Samba share from your Fedora box by
[root@machinename samba]# mount -t smbfs -o username=myusername,password=mypass //192.168.1.9/pub /mnt/sambamachinename
Now you can access Samba shares from another linux machine.
Quelle: http://fedoranews.org/krishnan/tutorial/samba/index.shtml
Autor: Krishnan Subramanian
============
Part 1: Installing Samba
Download the latest RPMs from http://us2.samba.org/samba/ftp/Binary_Packages/Fedora/RPMS/i386/core/2/.
You can alternately select any other mirrors from Samba Website.
Download the following RPMs from the nearest mirror.
samba-3.0.1-1.i386.rpm
samba-client-3.0.1-1.i386.rpm
samba-common-3.0.1-1.i386.rpm
samba-swat-3.0.1-1.i386.rpm
For the sake of explanation, let us assume that you save the files in /tmp/samba folder. Now this folder contains all the files needed for Samba installation including Samba client and swat (Samba Web Administration Tool)
Open a terminal window and login as root by using su command and entering the root password. If you are already logged in as root, skip this step and go to the next step.
[user@machinename samba]#su
Password:
If you are installing Samba for the first time, follow this step else skip this and go to the next step.
[root@machinename samba]# rpm -ivh samba-*.i386.rpm
warning: samba-3.0.1-1.i386.rpm: V3 DSA signature: NOKEY, key ID 2f87af6f
Preparing... ########################################### [100%]
1:samba-common ########################################### [ 25%]
2:samba ########################################### [ 50%]
3:samba-client ########################################### [ 75%]
4:samba-swat ########################################### [100%]
[root@machinename samba]#
You can safely ignore the warning right now. Information on the warning and taking care of it is beyond the scope of this tutorial. If you have Samba installed in the system, you can upgrade to the latest version by
[root@machinename samba]# rpm -Uvh samba-*.i386.rpm
Part 2: Configuring Samba
Now we will configure the Samba installation by editing the configuration file. The configuration file smb.conf is present in /etc/samba/. We will setup the configuration file to share the user's home directory and a public directory /tmp to share files among users.
[root@machinename samba]#cd /etc/samba
[root@machinename samba]#vi smb.conf
Under global settings,
[global]
workgroup = Myworkgroup
server string = Machinename Samba Server
This sets the workgroup name and the server string. You can assign the name of your workgroup and any server string you want to assign.
hosts allow = 192.168.1.
This is very important from the security point of view. You can set the hosts you want to allow here. In this example, all the hosts in the local area network with the IP addresses 192.168.1.* to access the Samba share.
security = user
In User Level Security, the client will send a session setup request directly following protocol negotiation. This request provides a username and password. The server can either accept or reject that username/password combination.
Under share definitions, you will see the following
[homes]
comment = Home Directories
browseable = no
writable = yes
This allows, for example, user joe to access his home directory from a windows machine or a Samba client.
[tmp]
comment = Temporary file space
path = /tmp
read only = no
public = yes
This allows access to /tmp directory in your Fedora machine from a windows machine or a Samba client.
Here we will digress a little bit to see the difference between [homes] and [tmp]. The [homes] option allows the users to access their respective home directories in the Fedora box. They can only access their own directory and not any other user's directory. This is not of much help if people want to share files with one another. So [tmp] option allows all users to share files in /tmp directory.
Save the file smb.conf and exit the editor.
Now we can test if the configuration is correct by using testparm.
[root@machinename samba]/usr/bin/testparm
Load smb config files from /etc/samba/smb.conf
Processing section "[homes]"
Processing section "[printers]"
Processing section "[tmp]"
Loaded services file OK.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions
Once you press enter, you should see something like this
# Global parameters
[global]
workgroup = Myworkgroup
server string = Machinename Samba Server
username map = /etc/samba/smbusers
log file = /var/log/samba/log.%m
max log size = 50
socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
dns proxy = No
hosts allow = 192.168.1.
[homes]
comment = Home Directories
read only = No
browseable = No
[printers]
comment = All Printers
path = /var/spool/samba
printable = Yes
browseable = No
[tmp]
comment = Temporary file space
path = /tmp/
read only = No
guest ok = Yes
This implies your configuration is ok and you are all set to start using Samba.You can also configure Samba so that members of a group can share files among themselves by using [groups] option in smb.conf file. This will be very helpful in an organization with different departments.
Part 3: Using Samba
Now that we have configured Samba, we can start using it. If you are upgrading from a previous version, you have to kill the Samba daemon (if it is running). To do this,
[root@machinename samba]killall smbd
[root@machinename samba]killall nmbd
Now we can start Samba with our new configuration by
[root@machinename samba]/usr/sbin/smbd -D
[root@machinename samba]/usr/sbin/nmbd -D
If you want to run Samba from xinetd instead, you can edit /etc/xinetd.conf and add the following lines
service netbios-ns
{
socket_type = dgram
protocol = udp
wait = yes
user = root
group = root
server = /usr/sbin/nmbd
}
service netbios-ssn
{
socket_type = stream
protocol = tcp
wait = no
user = root
group = root
server = /usr/sbin/smbd
}
Now we will test the Samba installation.
To test the Samba installation, we use the Samba client we installed. The -L netbios name switch tells smbclient to get a list of shares from the server specified by netbios name. I use the -N switch to suppress the prompting for a password because it is not needed to see just the shares that are available.
[root@machinename samba]# /usr/bin/smbclient -L localhost -N
Anonymous login successful
Sharename Type Comment
--------- ---- -------
tmp Disk Temporary file space
IPC$ IPC IPC Service (Machinename Samba Server)
ADMIN$ IPC IPC Service (Machinename Samba Server)
Anonymous login successful
Server Comment
--------- -------
Machinename Machinename Samba Server
Workgroup Master
--------- -------
Myworkgroup Machinename
The information given above may be different depending on your Samba configuration. The above example is based on the configuration file of a test machine. This is provided to give you an idea of what you will get when you try this. Having done this, we will now see how to use different clients to access Samba shares.
A brief description of how to access Samba share from different clients are given below. This is by no means exhaustive and if you want detailed explanation, you can refer to various articles available on this subject.
Windows 98
Windows 98 has built-in support for TCP/IP. But this is not installed as the default. To add TCP/IP, go to `Control Panel' --> `System' and choose `Add' --> `Protocols' --> `TCP/IP from Microsoft'. Be sure to enter your network address and network mask correctly. Reboot your windows 98 machine and the Samba share will be available in the Network Neighborhood. To use a printer on the samba server, you should install the printer driver from the corresponding Windows version
Windows 2000/XP
To map a drive using the Windows GUI, click on My Computer. On the toolbar options, select Map Network Drive (under Windows XP this option is under the Tools menu). Once selected, a new box will open up. In the Drive box, click a drive letter that you wish to use. In the Folder box, type the path for the server and path that you wish to connect to and click finish.
Alternately, you can use the following command from the command line
NET USE G: \\Machinename\tmp /YES
This will map the /tmp folder of your Fedora box to G drive.
Mac OS X
Make sure that SMB support is enabled in Directory Access Utility under Applications/Utilities. Activate Finder, select Go and then Connect to Server. In the server address field, type in the server address in one of the following formats.
smb://ServerName/ShareName/
smb://WORKGROUP@ServerName/ShareName
smb://WORKGROUP;User@ServerName/ShareName
Server address can be IP address or any valid DNS name. Please note that you will be unable to connect to any server that has a share name containing a hyphen or space in it. For spaces, you can try substituting a %20 in its place. After clicking Connect, you may be prompted for Authentication.
Linux If you are planning to install Samba in your Fedora box only, you can skip this section. But if you are going to mount Samba shares from any other linux box, you may continue reading.
Make sure that SAMBA_FS is compiled into your Kernel. If not, you will get the error message mount: fs type smbfs not supported by kernel when you try to mount the Samba share. If you get this message, recompile the kernel with SAMBA_FS. Now Samba must be installed in both the machines even if you are going to access Samba shares from only one machine. On your second machine, configure Samba with the --with-smbmount parameter. Using this option automatically creates the smbmount and smbumount commands along with the file /sbin/mount.smbfs (which is actually just a soft link to smbmount).
Now you can mount the Samba share from your Fedora box by
[root@machinename samba]# mount -t smbfs -o username=myusername,password=mypass //192.168.1.9/pub /mnt/sambamachinename
Now you can access Samba shares from another linux machine.
Zuletzt bearbeitet von einem Moderator: