Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Samba on LAN cant write

Status
Not open for further replies.

KeyserSoze1877

Programmer
Sep 6, 2001
95
US
I set up Samba 2.2.2 on my Suse box. I think I got everything configured correctly I think. I can see my Liunx box on the Windows network. I can see files on the Linux box and copy files off the Linux box. I can't, however, put files ONTO the Linux box. I get an error stating Access Denied file is already in use, this occurs for all types of files.

Secondly, how do I browse my Windows network from Linux?

Thanks.
 
Well, something relatively simple to check for the first part of your problem would be to make sure that you have rights to the directory on your Linux box. Make sure that it's not restricted to root or someone else.

As for your second question, you should be able to get to it through "My network places" and logging in to the appropriate system. The items should look like shared or mapped drives. (At least that's what happens on my server...)

Hope this helps,
Hobbes
 
Once you've solved the "Access Denied" problem, to see your Windows box from Linux I believe you will need a SAMBA client set up on your Linux box. In doing that I would think you'd find the answer you're looking for.
Hope this helps!
630111
 
As stated above I do have Samba set up, otherwise I could not see my Linux box from a Windows Machine. Unless I am missing a tool somewhere, I do not know how to view the windows machines from the Linux box. Where is Linux's version of Network Neighborhood?

I know what I need, just not how to get it.
 
Sorry about that, I seemed to be a bit dyslexic with your second question. The following should help:(its from o'reilly's Running Linux, 3rd edition) Sorry about the extreme length... Hope it helps...

12.1.1. Mounting DOS, VFAT, and NTFS Partitions
If you have already read the section "Section 6.1.2, "Mounting Filesystems"" in Chapter 6, "Managing Filesystems, Swap, and Devices", you know by now that you access partitions on local hard disks by "mounting" them into your directory hierarchy. In order to be able to read and write to a specific filesystem, the Linux kernel needs to have support for this filesystem.

In the section "Section 7.4, "Building a New Kernel"" in Chapter 7, "Upgrading Software and the Kernel", you learned how to build your own kernel. In order to be able to access DOS (used by MS-DOS and Windows 3.x) and VFAT (used by Windows 95 and Windows 98) partitions, you need to enable DOS FAT fs support in the filesystems section during kernel configuration. After you say yes to that option, you can choose MSDOS fs support and VFAT (Windows-95) fs support. The first lets you mount FAT partitions and the second lets you mount VFAT partitions. VFAT support is relatively recent; it appeared first in kernel Version 2.0.34, but really became stable only with recent kernel versions.

While Linux is running, you can then mount a Windows partition like any other type of partition. If, for example, the third partition on your first SCSI hard disk contains your Windows 98 installation, you can make those files accessible with the following command, which must be executed as root:

mount -t vfat /dev/sda3 /mnt/windows98
The /dev/sda3 option specifies the disk drive corresponding to the Windows 98 disk, while the /mnt/windows98 option can be changed to any directory you've created for the purpose of accessing the files. But how do you know that you need--in this case--/dev/sda3 ? If you're familiar with the arcane naming conventions for Linux filesystems (shown in Table 3-1), you'll know that sda3 is the third partition on the first SCSI hard disk, but you'll find life easier if you write down the partitions while you are creating them with fdisk.

Of course, you are free to choose other mount points than /mnt/windows98. If you want to mount a FAT partition, you do the same, but replace vfat with msdos in the previous command.

Both the msdos and the vfat filesystem driver support a number of options that can be specified with the -o option of the mount command, but in most cases, you will not need them. The man page tells you all the options. There are, however, two options that might be useful for you: check and conv.

The option check determines whether the kernel should accept filenames that are not permissible on MS-DOS and what it should do with them. Obviously, this applies only to creating and renaming files. You can specify three values for check: relaxed lets you do just about everything with the filename. If it does not fit into the 8.3 convention of MS-DOS files, the filename will be truncated accordingly. normal, the default, will also truncate the filenames as needed, but not accept special characters like * and ? that are not allowed in MS-DOS filenames. Finally, strict forbids both long filenames and the special characters. In order to make Linux more restrictive with respect to filenames on the partition mounted above, the mount command could be used as follows:

mount -o check=strict -t msdos /dev/sda5 /mnt/dos
Obviously, the restrictions of the filename length do not apply to vfat filesystems.

The second option that is potentially useful, but not quite ready for most users is conv. Windows and Unix systems have different conventions for how a line end is marked in text files. Windows uses both a carriage return and a linefeed character, while Unix only uses the linefeed. While this does not make the files completely illegible on the other system, it can still be a bother. To tell the kernel to perform the conversion between Windows and Unix text file styles automatically, you need to pass the mount command the option conv. conv has three possible values: binary, the default, does not perform any conversion; text converts every file; and auto tries to guess whether the file in question is a text file or a binary file. Auto does this by looking at the filename extension. If this extension is included in the list of "known binary extensions," it is not converted, otherwise it will be converted.

It is not advisable to use text, because this will invariable damage any binary files, including graphics files and files written by word processors, spreadsheets and other programs. Likewise, auto can be dangerous, because the extension-based detection mechanism is not very sophisticated. So we'd suggest you don't use the option. Stick with binary (the default) and convert your files on an as-needed basis.

If you want to access files on a Windows NT partition that carries an NTFS filesystem, you need another driver. Activate the option NTFS filesystem support during the kernel configuration. This lets you mount NTFS partitions by specifying the file system type ntfs. Note, however, that the current NTFS driver supports just read-only access. There is an alpha version of a driver available that supports writing as well, and so far, it has worked for us quite nicely, but we do not advise using this without backing up your NTFS partition first!

12.1.2. Using Samba to Mount Directories from Windows Systems on Your Network
So far, we have covered how to access Windows partitions on the same machine. In this section, we will extend this discussion to partitions (which in this context are often called shares) that reside on other servers. In Windows versions, starting with Windows for Workgroups, you can make directories or printers accessible for other computers. The protocol used for this feature is called SMB (Server Message Block). With the SMB support in Linux, you can access these directories from Linux. Note that the Windows machines must be configured to use TCP/IP in addition to or instead of the native Windows protocol NETBEUI, because the Linux SMB support does not include NETBEUI. Of course, your Linux machine must be set up for TCP/IP networking as well; see Chapter 15, "TCP/IP and PPP", to learn how to do that. For now, we will assume that a TCP/IP connection can be established between your Linux and your Windows computer.

In this section, we cover sharing in one direction: how to access files on Windows systems from Linux. The next section will show you how to do the reverse, and make selected files on your Linux system available to people on Windows systems.

In order to get SMB support running, you have to follow these steps:

Compile support for SMB into your kernel.

Install Samba (described in the next section) and create at least a minimal configuration file.

Mount the services with the smbmount command.

Let's go through these steps one at a time. The first one is easy: In the filesystems/Network File Systems section during kernel configuration, select SMB file system support (to mount WfW shares etc.). Compile and install your kernel, or install and load the module. If you plan to mount shares from a Windows 95 server, you should also select SMB Win95 bug work-around, which works around in bug in showing directories on a Windows 95 share. You don't need this if you are accessing shares only on a Windows 98 or Windows NT machine and should leave it off in this case because it slows down directory reading.

Next, you will need to install the Samba package. This package is meant for providing (not accessing) SMB shares, but its package contains one utility program and one configuration file you will need. If you do not have it on your machine (check whether the file /etc/smb.conf exists), please read the next section to learn how to get it.

You will learn about how to write the configuration file /etc/smb.conf in the next section, but for our purposes here, it suffices to have the following content:

[global]
socket options = TCP_NODELAY
There may be other configuration parameters in the [global] section; this parameter does not need to be the first. If you already have a smb.conf, there can be other socket options too. Don't let yourself be bothered by that; just make sure that you have the TCP_NODELAY option, as this speeds up directory reading a lot.

The last thing to do is to mount the partition (which in the Windows world is called a share). Unlike the partition types described in the last section and unlike the Network File System, you do not use the familiar mount command, but a special command from the Samba package called smbmount. This is because SMB shares have a different addressing scheme. Accordingly, you use smbumount for unmounting an SMB share.

If you are lucky, using smbmount can be quite easy. The general format is:

smbmount options servicename mount_point
where mount_point specifies a directory just as in the mount command. servicename follows more or less the Windows naming conventions, except that it replaces the backslashes with slashes. For example, if you want to mount a SMB share from the computer called winloser that is exported under the name mydocs onto the directory /windocs, you could use the following command:

tigger# smbmount //winloser/mydocs/ /windocs
You can also specify a directory below the exported root if you want to mount only a part of the share. For example, suppose we didn't want to share everything in the mydocs directory of the previous example, but just a subdirectory under it called htmldocs. We could say:

tigger# smbmount //winloser/mydocs/htmldocs /windocs
If a password is needed to access the share, smbmount will ask you for it.

As we previously wrote, if you are lucky, the preceding steps could be everything you need. But if you are unlucky, things could get messy here. If you do not know much about how Windows computers handle networking, you might want to seek help from the person who has set up the Windows machine where the files that you are trying to access are.

The most common problem is that in the SMB protocol, machines can have two different hostnames: the normal hostname and a NetBIOS name. While having two names might not be a good idea anyway, you will not be able to simply mount a SMB share with the previous commands if the two differ. If you know the NetBIOS name, you can pass it with the -s option:

tigger#smbmount -s nbname //winloser/mydocs/ /windocs
Another thing to try is to tell smbmount about the IP address of the machine exporting the SMB share. This is done with the -I option (see Chapter 15, "TCP/IP and PPP" to learn about IP addresses). If the server has the IP address 192.168.0.5, you could try the following command:

tigger# smbmount -I 192.168.0.5 //winloser/mydocs/ /windocs
Please see the manual page for smbmount for further tricks to try.

One problem with the smbmount command is that is does not really tell you what went wrong. For hints on what the problem is, try the utility program smbclient, which also comes from the Samba package. smbclient lets you copy files to and from a SMB share and list its directory contents, and it has the advantage of providing a little more detailed error messages. See the manual page for smbclient for further details. If you can access a SMB share with smbclient, but not with smbmount, it is very likely that either SMB support is not available in the kernel or that the mount point cannot be accessed, that is, that the problem has nothing to do with the network.

 
Yeah, most folks usually only go one way with it, usually showing linux on windows. Going the other way is a bit rarer...

Good luck...
Hobbes
 
You can see your Linux box from Windows because you have the SAMBA server set up on the Linux box. If you want it the other way around, to see your Windows network from your Linux box, you need to set up a SAMBA client on your Linux box.
Just trying to help!
630111
 
What kind of password scheme are you using? I am assuming that you are not using Domain level security (IE you added the samba server to an NT/2000 based Domain.).

If not do you have any users in the smbpasswd file? I think you need your Windows account in there. Else in the smb.conf file what do you have listed for your share?


 
Hi,

Did you put 'read only=no' into the share definition within smb.conf ? For example :

[test]
path=/usr/test
read only=no

The above lets anyone read/write/create/delete. To make it a bit more restrictive use 'write list=' ...

[test]
path=/usr/test
write list=joeuser,joeuser2

That would allow two users only to r/w . If you use @group1 instead of a username it applies to everyone in the matching linux security group.

Hope this helps


 
Hi.

I just got this working the other day. Here's how I can get files from my Win98 box to my Linux system.

From Linux I type in:

smbclient //PC98/C [win98 password] -U [win98 login name]

You will then get a prompt like this:

smb:\>

From there you can view whatever files you have shareable on your Windows system. Looks just like an FTP service.

In the above example my Win98 machine is called PC98 and I made the C: drive shareable. If I only had a particular subdirectory shared -- say "XFER" -- then my command would be:

smbclient //PC98/XFER [win98 password] -U [win98 login name]

Hope this helps.
 
I assume this will be the same terminology for Windows2000 Server. Thats my Windows environemnt I am trying to get hooked up to.
 
Of all the replies the most basic setup was over looked which I discovered.

After Samba was all setup, no probs there, the reason I could not copy files from Windows to Linux was that the shared directory on Linux did not allow my account I setup for the Windows client to use to write to that directory.

 
in samba if i access from windows than int access but if i wants aceess windows machine from linux than what to do
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top