Q: How to add a (Windows Server) network drive.

Joined
Aug 1, 2008
Messages
17
Reaction score
0
Hello people.
Yesterday I became the proud owner of a Acer Aspire one, i was satisfied.
My only dissapointement was that Pesky OS it was deliverd with, Linpus.

And now, to my question;
On my network i have a storage/file server, to acces it in windows i normaly typed in internet explorer the ip, (\\192.168.0.111\) and it would promt me for a username and password. and gave me acces. i tried to do the same thing on my new Aspire One but all for not.

Can someone please help me?

Thanks in advance.

Aviel O. :arrow:
 
Hi,
I also wondered about this, since it's so easy to do on for instance Ubuntu.
However, I came across a solution using the built-in tool mount.cifs (see http://linux.die.net/man/8/mount.cifs).
This is a shell command that you may put into a shell script file.

1) You need to create one dummy folder for each network share you want to use. For instance, in your home directory, create the folder NAS. You can do this with the file manager thunar (that opens with My Files in the main menu).

2) Then, in your home folder, right click and select Open Terminal Here.

3) Type the command su and then your password. This gives you the necessary rights.

4) Now you can mount your share and map it to the folder you created earlier. Say you have the following parameters:
Machine IP: 192.168.1.2
Share name: files
Local folder: NAS
Username: MyName
Password: MyPass

Then the mount command will be the following:

Code:
mount.cifs \\\\192.168.1.2\\files NAS -o user=MyName,password=MyPass,uid=user,gid=user
It's correct that there should double up with back-slashes.

5. Leave the terminal by typing the exit command twice.


I chose to put the mount commands for my shares into a shell script file Mount.sh in my home directory. So whenever I need my shares, I just double click that file. Then, you need to prefix the mount.cifs command with sudo, like this

Code:
sudo mount.cifs .....

After creating the file with the Mousepad editor, I make it executable by right-clicking it, selecting properties and setting Open with to bash.

If you use a wireless network, remember that you need to be connected before mounting the shares. This means that you cannot put the mount commands into a start up script.

I also tried the tool pyNeighborhood, but found it easier to use the shell script approach above. If anybody knows a better - or easy way - I'd be happy to know.

Good luck!
 
Thanks for that! Works great for me, although my nas uses guest logins so I had to use something like:
Code:
mount.cifs \\\\storagebox\\songs Songs -o guest
 
There's also the possibility to make the mounts "permanent" by adding them to the /etc/fstab file, as explained in this post: http://www.aspireoneuser.com/forum/...99&sid=6f5f990ae0a79af33c37c534399810dc#p4864.

According to guides out there, the auto option (default) should cause the share(s) to be automatically mounted at boot time. This seems not to be the case with Linpus, or there is something missing in the guide. As far as I can tell, you need to use the terminal command
Code:
sudo mount -a
before you need your shares.

Beware of the codepage option if you have file names in other languages than English. In Norway the Danish/Norewgian letters æøå often occur in file names, and code page 850 causes these letters to be displayed incorrectly. I deleted the codepage option, and it actually worked as it should.

There is also an extra option _netdev which should defer mounting until a network connection is present. Since the shares aren't mounted automatically at boot time anyway, it seems to have no effect.

The following guide is quite good, even if it's for openSUSE:
http://www.swerdna.net.au/linhowtosambacifs.html
 
I seem to be getting the following error when trying to map a network share using this method:

'can not change directory into mount target share'

I'm a total newbie to linux so this has thrown me. Any suggestions?

Thanks.
 
One more way
In terminal run

#sudo yum -y install fuse-smb

after this create mount point, for example

#sudo mkdir /mnt/samba

and run

#sudo fusesmb -o allow_other /mnt/samba

After this in /mnt/samba U have access to all workgroups

Bigroma
 
Thanks much.. this really helped me out!!

Is there a way to run the fuse-smb command at bootup so shares are avaialble at boot?
 
stevenross said:
I seem to be getting the following error when trying to map a network share using this method:

'can not change directory into mount target share'

I'm a total newbie to linux so this has thrown me. Any suggestions?

Thanks.
I had that problem, don't know what it was, but using the instructions on this page, it ended up working, I think it needed some extra parts in the command
http://thatsquality.com/linux/mounting- ... using-cifs

The command:
sudo mount -t cifs //192.168.1.102/share_name /media/my_share -o username=theuser,password=thepass,iocharset=utf8,file_mode=0777,dir_mode=0777

Are you trying to connect to Vista, by any chance? I was, perhaps it needs the 0777 chmod stuff at the end.
 
Great instructions, but drive unmounts when the machine is rebooted/switched off. I've written a simple script to activate the mounting: in terminal I type:-

cd /home
sh ./script.sh

But I can't execute it in XWindow. I have used:

chown user script.sh

and made the file executable then tried executing it. Nothing.
I tried executing after "chown root script.sh" and still nothing.
If I can have this file executable there is no problem, but otherwise I have to type "fusesmb -o allow_other /mnt/samba" every boot-up.

It occurs to me that I may have completely the wrong file extension. My programming skills are INCREDIBLY limited - I have only ever written the odd .bat file on windows and I was under the impression that a .sh was the linux equivalent. perhaps give me a pointer on the correct extension?

I'd like it simple to activate, is all.

Anyone got any thoughts?
 
You can't run a shell script directly by pointing and clicking in the GUI. As the name implies, it has to run within the shell, e.g. a in a terminal. Extensions doesn't matter in Linux/Unix.
 
I'm sure it's not supposed to work like that in linux, but applying a windows approach works: you can rename the file to .sh, then right click to open it with bash, make sure it's checked to open with bash everytime, and there you have it... a shell script you can click on.
 
I'm working on a scheme to get fusesmb kicked off on boot and also a script that installs all of this automagically for people. Search for "fusesmb" for the thread where I#m woffling on about this, but I#ll make a guide once it's all working.
Ian
 
OK, this is ready for testing, initially by someone who knows what they are doing. I have not yet tested this script as my wife won't allow me to potentially mess up the machine as I don't have time to fix it tonight. Also, this is already done on my machine, so it isn't a great test.

Anyway, copy this text to a file in your home directory, start the terminal, use "chmod +x thefile" to make it executable, and then run with "./thefile" I have deliberately not given lots of detail here!

I think you should be able to read this file and see what it's doing. Note the last line - if your workgroup has a different name, you'll need to change it. A release script would have this as an optional parameter. A release script can also be a tarball that can just be opened and the script executed.

----------------- starts here ------------
#! /bin/sh
# Move to users home
cd ~
# Exit script if anything fails
set -e
# Install fuse-smb
sudo yum -y install fuse-smb
# Create a mount point
sudo mkdir /mnt/net
# Create the xfce autostart file to run fusesmb at boot
cat > Fusesmb.desktop <<EOF
[Desktop Entry]
Encoding=UTF-8
Version=0.9.4
Type=Application
Name=Fuse
Comment=Connect to Windows network
Exec=/usr/local/bin/auto-fusesmb
StartupNotify=false
Terminal=false
Hidden=false
EOF
chmod +x Fusesmb.desktop
mv Fusesmb.desktop .config/autostart/
# Create the script that keeps trying until fusesmb runs (it fails if the network isn't up)
cat > auto-fusesmb <<EOF
#! /bin/sh
false
until [ $? -eq 0 ]; do
sleep 5
sudo fusesmb -o allow_other /mnt/net
done
EOF
chmod +x auto-fusesmb
sudo mv auto-fusesmb /usr/local/bin/
# Start fusesmb so user doesn't have to reboot
sudo /usr/local/bin/auto-fusesmb
# Create link - maybe not a good idea as workgroup might not be called HOME?
ln -s /mnt/net/HOME Network
----------------- ends here ------------

After this has run, you should have a folder in your home called "Network" that shows your workgroup. If you want shortcuts directly to machines, use your own version of "ln" to create them.

Ian
 
Ian,

Tried using your script, some success, some failure.

everything appear to work, and could indeed access ALL of the shared drives on my windows network, including those that periodically appear when for example my wifes laptop is on.

What doesn't appear to work (for me at least) is the autostart entry, I ran xfce4-autostart-editor to check the autostart entry, and looks OK, but the link shows broken.

sudo fusesmb -o allow_other /mnt/net, or re-run the script (the script will produce errors because the files and links already exist)

auto-fusesmb is in the autostart folder, and I can confirm all the directories and files exist as per the script.

Regards,

Cookie.
 
Just one addition to hkalnes excellent post. This will be obvious to most but I'm adding this for all the newbies like me. When I tried to make the 'mount.sh' executable the way he/she says, I didn't have I didn't have 'Bash' as an option in the properties. Instead, I clicked on the permissions tab and checked 'allow this file to run as a program'. I can then double click to execute.
Although we'd all like to see all our files without running a script, it's really not very inconvenient- you just leave the script file beside the NAS folder and run it before opening the folder, once each session.

Thanks for your help.
 
Does anyone get "permission denied" responses with Fuse-smb?

I installed it via add/remove software and can browse to my "workgroup" and see all the folders therein but whenever I try to access any fodler I get permission denied... they are unprotected as I can access them no problems on my other Linux system using Nautilus with no credentials....

I ran:

sudo fusesmb -o allow_other /mnt/samba

then browsed to /mnt/samba in both the terminal and Thunar - same error.

What have I missed!?

thanks!
 
The script has a small error which means that the auto start does not work (as Cookie reported). The problem is that the "$?" needs to be escaped in the original script otherwise it is just substituted as "0". Take a look in the generated /usr/local/bin/auto-fusesmb file and the line:

until [ 0 -eq 0 ]; do

should be:

until [ $? -eq 0 ]; do

[One can probably escape it with quotes or a \ but I haven't tried it!]

Marathon
 
Oops, my bad. Here is a fixed version, and I have confirmed it writes auto-fusesmb correctly.

Anyone who has a broken auto-fusesmb can edit it using "sudo mousepad /usr/local/bin/auto-fusesmb" and change the until line to have $? in place of the first 0.

----------------- starts here ------------
#! /bin/sh
# Move to users home
cd ~
# Exit script if anything fails
set -e
# Install fuse-smb
sudo yum -y install fuse-smb
# Create a mount point
sudo mkdir /mnt/net
# Create the xfce autostart file to run fusesmb at boot
cat > Fusesmb.desktop <<EOF
[Desktop Entry]
Encoding=UTF-8
Version=0.9.4
Type=Application
Name=Fuse
Comment=Connect to Windows network
Exec=/usr/local/bin/auto-fusesmb
StartupNotify=false
Terminal=false
Hidden=false
EOF
chmod +x Fusesmb.desktop
mv Fusesmb.desktop .config/autostart/
# Create the script that keeps trying until fusesmb runs (it fails if the network isn't up)
cat > auto-fusesmb <<EOF
#! /bin/sh
false
until [ \$? -eq 0 ]; do
sleep 5
sudo fusesmb -o allow_other /mnt/net
done
EOF
chmod +x auto-fusesmb
sudo mv auto-fusesmb /usr/local/bin/
# Start fusesmb so user doesn't have to reboot
sudo /usr/local/bin/auto-fusesmb
# Create link - maybe not a good idea as workgroup might not be called HOME?
ln -s /mnt/net/HOME Network
----------------- ends here ------------

Ian
 
Back
Top