# smbfs mount, works from command line, not netmount (FIXED)

## quikchaos

I have been searching a couple days now for an answer to my problem, unsuccessfully.

I am looking to have a Windows XP share mounted on startup. I have been using my .xinitrc to mount the share when I startx, which is working just fine. Except, everytime I exit X back the CL, and startx again, in re-creates a process "mount.smbfs" over and over again. I frequently go back and forth between command line and X. I would like to have this mounted at startup instead.

I added the following to my /etc/fstab.

```
//citadelserver/D   /mnt/ci      smbfs      password=<mypassword>   0 0
```

I get an error on startup when netmount is started.

```
5809: tree connect failed: ERRDOS - ERRnoaccess (Access denied.)
```

I have tried adding <local myuse="portmap samba"> to my /etc/init.d/netmount to ajust it's runlevel timing with no avail.

I tried to get this working with the local.start | local.stop files also. Same error.

This is the line in my local.start. If type this exact command from the command line after login, it works perfectly.

```
mount.smbfs //citadelserver/D /mnt/ci -o password=<mypassword>
```

Since it has been working fine from .xinitrc for the last month just fine, I can't imagine it would be share settings on the file server.  Any answers would be greatly appreciated!

----------

## quikchaos

Has no one else encountered this problem?

----------

## Pusikas

Tried this, does not work. Don't know why. I have problems getting a NFS server to work, so I tried out samba.  Anybody ideas?

----------

## sieter

If you log in, you do that as a regular user, right?

I guess you have the same username on your XP-box...

If you try to mount it at boot time, that´s done by root;

your XP-box doesn´t probably like root, so try to add your

username to the mount command...

----------

## quikchaos

Ah, nice point sieter. I will try adding the username also to my fstab.

Although that command:

```
mount.smbfs //citadelserver/D /mnt/ci -o password=<mypassword>
```

Does work while logged in as root. I am at work now, I will try it when I get home.

So when things are executed at start-up, before anyone logs in, it does infact execute all these things (samba, netmount, etc.) as root, correct?

----------

## quikchaos

I figured it out finally. You can use a credentials file and that seemed to do the trick.

Here is my fstab entry:

```
//citadelserver/D   /mnt/ci      smbfs      credentials=/etc/samba/credentials   0 0
```

Inside this 'credentials' file is simply these two lines.

```
username = Fileserver

password = <mypassword>

```

This share now gets mounted at boot time like it is supposed to. Hope this helps someone.

I also stripped the permissions of the credentials file down to 

```
-rw-------
```

----------

