How do I mount Samba share as non-root userMount SMB share with gvfs from command lineAdd files from a network location in VLCHow to change GVFS mount point?how do you mount network drives?is there any way to mount cifs partitions with only user permissionsCannot mount Windows 98 SE share over SSH to Ubuntu 14.04How to mount a samba share permanently?Copy files to an SMB share as non-root userCan't mount CIFS driveMount my own samba share?Samba: Share directory with a specific Windows 10 user without password requiredCannot mount samba network share
How is Team Scooby Doo (Mystery Inc.) funded?
Extending a 2d plot to 3d
How to say "quirky" in German without sounding derogatory?
What is a realistic time needed to get a properly trained army?
Is low emotional intelligence associated with right-wing and prejudiced attitudes?
How do email clients "send later" without storing a password?
Will replacing a fake visa with a different fake visa cause me problems when applying for a legal study permit?
How do EVA suits manage water excretion?
Telling my mother that I have anorexia without panicking her
Linear Programming with additional "if-then"/"Default to zero" constraints?
Are Democrats more likely to believe Astrology is a science?
What jurisdiction do Scottish courts have over the Westminster parliament?
How to work with a technician hired with a grant who argues everything
Could a Scotland-NI bridge break Brexit impasse?
Uncovering the Accelerated Dragon opening
Why did it become so much more expensive to start a university?
Not to protest, but -
My research paper filed as a patent in China by my Chinese supervisor without me as inventor
How can I fix a framing mistake so I can drywall?
I was promised a work PC but still awaiting approval 3 months later so using my own laptop - Is it fair to ask employer for laptop insurance?
What is this unknown executable on my boot volume? Is it Malicious?
Why is the T-1000 humanoid?
Is English tonal for some words, like "permit"?
What exactly is a marshrutka (маршрутка)?
How do I mount Samba share as non-root user
Mount SMB share with gvfs from command lineAdd files from a network location in VLCHow to change GVFS mount point?how do you mount network drives?is there any way to mount cifs partitions with only user permissionsCannot mount Windows 98 SE share over SSH to Ubuntu 14.04How to mount a samba share permanently?Copy files to an SMB share as non-root userCan't mount CIFS driveMount my own samba share?Samba: Share directory with a specific Windows 10 user without password requiredCannot mount samba network share
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
Is there a step-by-step tutorial that instructs in detail how to smbmount a Samba share to be used by a non-root user on a Ubuntu 10.04 desktop?
Note: there are numerous threads on Google search dealing with this seemingly new problem. Instructions that used to work on Ubuntu 8.04 (or an older version of smbfs) no longer work.
I need to find something that's up to date and reproducible.
mount samba cifs
add a comment
|
Is there a step-by-step tutorial that instructs in detail how to smbmount a Samba share to be used by a non-root user on a Ubuntu 10.04 desktop?
Note: there are numerous threads on Google search dealing with this seemingly new problem. Instructions that used to work on Ubuntu 8.04 (or an older version of smbfs) no longer work.
I need to find something that's up to date and reproducible.
mount samba cifs
add a comment
|
Is there a step-by-step tutorial that instructs in detail how to smbmount a Samba share to be used by a non-root user on a Ubuntu 10.04 desktop?
Note: there are numerous threads on Google search dealing with this seemingly new problem. Instructions that used to work on Ubuntu 8.04 (or an older version of smbfs) no longer work.
I need to find something that's up to date and reproducible.
mount samba cifs
Is there a step-by-step tutorial that instructs in detail how to smbmount a Samba share to be used by a non-root user on a Ubuntu 10.04 desktop?
Note: there are numerous threads on Google search dealing with this seemingly new problem. Instructions that used to work on Ubuntu 8.04 (or an older version of smbfs) no longer work.
I need to find something that's up to date and reproducible.
mount samba cifs
mount samba cifs
edited Mar 19 '16 at 8:04
Robbie Wxyz
2172 silver badges18 bronze badges
2172 silver badges18 bronze badges
asked Feb 1 '11 at 18:33
Android EveAndroid Eve
6304 gold badges10 silver badges23 bronze badges
6304 gold badges10 silver badges23 bronze badges
add a comment
|
add a comment
|
4 Answers
4
active
oldest
votes
A very nice tool to easily mount your samba shares in your home folder is SMBNetFS. With this tool you can access your samba shares by nearly all applications simply through a mount point in your home.
How to use SMBnetFS:
- Install the package through your package manager
cp /etc/smbnetfs.conf ~/.smb/smbnetfs.conf
copy standard configurationcp /etc/samba/smb.conf ~/.smb/smb.conf
copy samba configurationmkdir ~/sambashare
or any other name for the mount pointsmbnetfs ~/sambashare
mount the shares to the mountpoint
Unfortunately there is only little documentation available. See man smbnetfs
for options and go through the FAQ file in /usr/share/doc/smbnetfs
.
+1 for the detailed steps. I hope this works with Eclipse, because with gvfs Eclipse definitely doesn't work. Do you happen to know how SMBnetFS is different from smbfs?
– Android Eve
Feb 1 '11 at 23:14
2
SMBNetFS uses fuse. Make sure users are in thefuse
group.
– Takkat
Feb 1 '11 at 23:23
+1 again! Doesn't gfvs use FUSE as well? How is it different from what I already have prepackaged (gvfs) with my GNOME desktop?
– Android Eve
Feb 1 '11 at 23:38
add a comment
|
When using gnome, you can simply type in the smb:// url into Nautilus. Normally gvfs-fuse and other gvfs packages should be installed, so that you can mount samba directly with the file browser. Additionally you should find all mounted stuff in your ~/.gvfs folder. This even works with other protocols and compressed files etc.
gvfs-mount smb://user@server/storage
I've tested it with eclipse and other tools and it works. gvfs-fuse must be installed.
Thanks but Eclipse won't work with this. I tried this already, that's why I was specifically asking about smbmount (a symbolic link to mount.cifs which is part of the smbfs package).
– Android Eve
Feb 1 '11 at 23:09
2
So eclipse can't access .gvfs in your home dir? As far as I know, every program should be able to do this. Correct me if I'm wrong.
– matthias.lukaszek
Feb 2 '11 at 9:23
add a comment
|
man mount
will help you determine what options you want. If the windows system will always be available. You can just add the mount to the /etc/fstab
and it will be mounted. You can allow the user to mount and unmount the partition as required using the options user,noauto
. To allow others to unmount it change user
to users
.
Autofs also supports on demand mounts using samba. The incantation depends on which directories you want mounted when. I've run it successfully in a development environment.
EDIT: If you need to do this for a lot of users, I suggest using autofs to do the mounting. This does not require changes to fstab. Obtaining credentials for the various users may be a problem. I use a directory structure in the form /net/$HOST/$USER
for my mounts. Autofs is configured for the /net/$HOST
portion of the mount and automatically mounts the directories under it as needed.
Particular mounting approaches depend on your needs. I have had cases where users needed their Desktop directory mounted on the server, although typical mounts are server based.
For large organization with lots of user it may make sense to move the directories to a Linux server and use Samba to share the files to Windows users. I haven't tried the reverse, but it may be possible.
This works, but you need root access to change fstab. Even if are root, note that it is quite impractical if you have to do it for a lot of users, each with a specific share to mount (as in a large organization where each user has a personal share in a centralized file server).
– user46513
Feb 15 '12 at 13:11
add a comment
|
I found this question while researching the magic I performed recently to do exactly this for one of my users. My workflow differs remarkably to the other answers. Do note, however, this is about the most simple case possible.
Assuming your username is ae
and your home is /home/ae
1) Set up smbfs:mkdir /home/ae/.smb
1a) If windows login credentials are needed, create and edit the file: /home/ae/.smb/smbnetfs.conf
to have contents:
auth winuser "winpassword"
winuser
is the user created on the Windows computer you wish to access. winpassword
is that user's password to log in to Windows on that computer.
2) Create your mount point:mkdir /home/ae/nethood
3) Execute the smbnetfs command:smbnetfs /home/ae/nethood
Note the entire "network neighborhood" will show up under /home/ae/nethood
with the workgroups being the first layer of subdirectories.
All of the listings below were copied from my browsing of folders as a non privileged user on an ubuntu host. Username and group changed to ae
. sudo
was never used. The Windows computers are on informal Windows network and shared folders are user/password protected (on the Windows computer using the windows username and password).
$ cd nethood
$ ls -alh
total 12K
drwxrwxrwx 9 ae ae 0 Dec 31 1969 .
drwxr-xr-x 9 ae ae 21 Jul 28 11:49 ..
drwxrwxrwx 2 root root 0 Dec 31 1969 WORKGROUP
Browse the workgroup WORKGROUP
:
$ cd WORKGROUP
$ ls -alh
total 0
drwxrwxrwx 2 root root 0 Dec 31 1969 .
drwxrwxrwx 9 root root 0 Dec 31 1969 ..
lrwxrwxrwx 1 root root 11 Dec 31 1969 HTPC -> ../HTPC
lrwxrwxrwx 1 root root 14 Dec 31 1969 NEWPC -> ../NEWPC
Change directory to computers and any shared folders will be listed and accessed as normal.
$ cd NEWPC
$ ls -alh
total 0
drwxrwxrwx 2 root root 0 Dec 31 1969 .
drwxrwxrwx 9 root root 0 Dec 31 1969 ..
drwxrwxrwx 2 root root 0 Dec 31 1969 Desktop
drwxrwxrwx 2 root root 0 Dec 31 1969 Users
And the files:
$ cd Desktop/
$ ls -alh
ls: cannot access desktop.ini: No such file or directory
total 30M
drwxrwxrwx 2 root root 0 Dec 31 1969 .
drwxrwxrwx 2 root root 0 Dec 31 1969 ..
-rwxr--r-- 1 ae ae 1.5K Jan 25 2013 Command Prompt.lnk
-????????? ? ? ? ? ? desktop.ini
-rwxr--r-- 1 ae ae 156K May 28 2013 Download %25285%2529.iif
-rwxr--r-- 1 ae ae 2.4K Jul 24 12:28 Google Chrome.lnk
-rwxr--r-- 1 ae ae 178 Feb 4 2013 import orders.bat
-rwxr--r-- 1 ae ae 2.3M Mar 30 2012 msvc2008_x86_vcredist_x64.exe
drwxr-xr-x 2 ae ae 0 May 20 2014 OpenOffice 4.1.0 (en-US) Installation Files
-rwxr--r-- 1 ae ae 406K Jun 6 2013 Paypal_Jan_1_2012_to_Dec_31_2012.iif
-rwxr--r-- 1 ae ae 15M May 8 2012 php-5.4.3-Win32-VC9-x86.zip
-rwxr--r-- 1 ae ae 1.9K Jul 24 13:03 PSPad.lnk
-rwxr--r-- 1 ae ae 1.1K Jul 24 12:31 VB Demo.lnk
Notice the above directories have ownership root root
. File ownership will be the same as your user.
No other users will be able to access the folders regardless of the mount point or that folder's ownership or permissions. If your user can "write" to that folder (and it is empty), smbnetfs will mount the network neighborhood there and not allow anyone else access, even root
. For root
to have access, you must su ae
.
If there are no shared folders, the computer's directory will be empty.
If you do not have credentials to the Windows computer, you may get the error:ls: cannot open directory .: Input/output error
add a comment
|
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "89"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f24348%2fhow-do-i-mount-samba-share-as-non-root-user%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
A very nice tool to easily mount your samba shares in your home folder is SMBNetFS. With this tool you can access your samba shares by nearly all applications simply through a mount point in your home.
How to use SMBnetFS:
- Install the package through your package manager
cp /etc/smbnetfs.conf ~/.smb/smbnetfs.conf
copy standard configurationcp /etc/samba/smb.conf ~/.smb/smb.conf
copy samba configurationmkdir ~/sambashare
or any other name for the mount pointsmbnetfs ~/sambashare
mount the shares to the mountpoint
Unfortunately there is only little documentation available. See man smbnetfs
for options and go through the FAQ file in /usr/share/doc/smbnetfs
.
+1 for the detailed steps. I hope this works with Eclipse, because with gvfs Eclipse definitely doesn't work. Do you happen to know how SMBnetFS is different from smbfs?
– Android Eve
Feb 1 '11 at 23:14
2
SMBNetFS uses fuse. Make sure users are in thefuse
group.
– Takkat
Feb 1 '11 at 23:23
+1 again! Doesn't gfvs use FUSE as well? How is it different from what I already have prepackaged (gvfs) with my GNOME desktop?
– Android Eve
Feb 1 '11 at 23:38
add a comment
|
A very nice tool to easily mount your samba shares in your home folder is SMBNetFS. With this tool you can access your samba shares by nearly all applications simply through a mount point in your home.
How to use SMBnetFS:
- Install the package through your package manager
cp /etc/smbnetfs.conf ~/.smb/smbnetfs.conf
copy standard configurationcp /etc/samba/smb.conf ~/.smb/smb.conf
copy samba configurationmkdir ~/sambashare
or any other name for the mount pointsmbnetfs ~/sambashare
mount the shares to the mountpoint
Unfortunately there is only little documentation available. See man smbnetfs
for options and go through the FAQ file in /usr/share/doc/smbnetfs
.
+1 for the detailed steps. I hope this works with Eclipse, because with gvfs Eclipse definitely doesn't work. Do you happen to know how SMBnetFS is different from smbfs?
– Android Eve
Feb 1 '11 at 23:14
2
SMBNetFS uses fuse. Make sure users are in thefuse
group.
– Takkat
Feb 1 '11 at 23:23
+1 again! Doesn't gfvs use FUSE as well? How is it different from what I already have prepackaged (gvfs) with my GNOME desktop?
– Android Eve
Feb 1 '11 at 23:38
add a comment
|
A very nice tool to easily mount your samba shares in your home folder is SMBNetFS. With this tool you can access your samba shares by nearly all applications simply through a mount point in your home.
How to use SMBnetFS:
- Install the package through your package manager
cp /etc/smbnetfs.conf ~/.smb/smbnetfs.conf
copy standard configurationcp /etc/samba/smb.conf ~/.smb/smb.conf
copy samba configurationmkdir ~/sambashare
or any other name for the mount pointsmbnetfs ~/sambashare
mount the shares to the mountpoint
Unfortunately there is only little documentation available. See man smbnetfs
for options and go through the FAQ file in /usr/share/doc/smbnetfs
.
A very nice tool to easily mount your samba shares in your home folder is SMBNetFS. With this tool you can access your samba shares by nearly all applications simply through a mount point in your home.
How to use SMBnetFS:
- Install the package through your package manager
cp /etc/smbnetfs.conf ~/.smb/smbnetfs.conf
copy standard configurationcp /etc/samba/smb.conf ~/.smb/smb.conf
copy samba configurationmkdir ~/sambashare
or any other name for the mount pointsmbnetfs ~/sambashare
mount the shares to the mountpoint
Unfortunately there is only little documentation available. See man smbnetfs
for options and go through the FAQ file in /usr/share/doc/smbnetfs
.
edited Feb 23 '17 at 15:17
Zanna
53.2k14 gold badges150 silver badges250 bronze badges
53.2k14 gold badges150 silver badges250 bronze badges
answered Feb 1 '11 at 22:39
TakkatTakkat
113k40 gold badges260 silver badges385 bronze badges
113k40 gold badges260 silver badges385 bronze badges
+1 for the detailed steps. I hope this works with Eclipse, because with gvfs Eclipse definitely doesn't work. Do you happen to know how SMBnetFS is different from smbfs?
– Android Eve
Feb 1 '11 at 23:14
2
SMBNetFS uses fuse. Make sure users are in thefuse
group.
– Takkat
Feb 1 '11 at 23:23
+1 again! Doesn't gfvs use FUSE as well? How is it different from what I already have prepackaged (gvfs) with my GNOME desktop?
– Android Eve
Feb 1 '11 at 23:38
add a comment
|
+1 for the detailed steps. I hope this works with Eclipse, because with gvfs Eclipse definitely doesn't work. Do you happen to know how SMBnetFS is different from smbfs?
– Android Eve
Feb 1 '11 at 23:14
2
SMBNetFS uses fuse. Make sure users are in thefuse
group.
– Takkat
Feb 1 '11 at 23:23
+1 again! Doesn't gfvs use FUSE as well? How is it different from what I already have prepackaged (gvfs) with my GNOME desktop?
– Android Eve
Feb 1 '11 at 23:38
+1 for the detailed steps. I hope this works with Eclipse, because with gvfs Eclipse definitely doesn't work. Do you happen to know how SMBnetFS is different from smbfs?
– Android Eve
Feb 1 '11 at 23:14
+1 for the detailed steps. I hope this works with Eclipse, because with gvfs Eclipse definitely doesn't work. Do you happen to know how SMBnetFS is different from smbfs?
– Android Eve
Feb 1 '11 at 23:14
2
2
SMBNetFS uses fuse. Make sure users are in the
fuse
group.– Takkat
Feb 1 '11 at 23:23
SMBNetFS uses fuse. Make sure users are in the
fuse
group.– Takkat
Feb 1 '11 at 23:23
+1 again! Doesn't gfvs use FUSE as well? How is it different from what I already have prepackaged (gvfs) with my GNOME desktop?
– Android Eve
Feb 1 '11 at 23:38
+1 again! Doesn't gfvs use FUSE as well? How is it different from what I already have prepackaged (gvfs) with my GNOME desktop?
– Android Eve
Feb 1 '11 at 23:38
add a comment
|
When using gnome, you can simply type in the smb:// url into Nautilus. Normally gvfs-fuse and other gvfs packages should be installed, so that you can mount samba directly with the file browser. Additionally you should find all mounted stuff in your ~/.gvfs folder. This even works with other protocols and compressed files etc.
gvfs-mount smb://user@server/storage
I've tested it with eclipse and other tools and it works. gvfs-fuse must be installed.
Thanks but Eclipse won't work with this. I tried this already, that's why I was specifically asking about smbmount (a symbolic link to mount.cifs which is part of the smbfs package).
– Android Eve
Feb 1 '11 at 23:09
2
So eclipse can't access .gvfs in your home dir? As far as I know, every program should be able to do this. Correct me if I'm wrong.
– matthias.lukaszek
Feb 2 '11 at 9:23
add a comment
|
When using gnome, you can simply type in the smb:// url into Nautilus. Normally gvfs-fuse and other gvfs packages should be installed, so that you can mount samba directly with the file browser. Additionally you should find all mounted stuff in your ~/.gvfs folder. This even works with other protocols and compressed files etc.
gvfs-mount smb://user@server/storage
I've tested it with eclipse and other tools and it works. gvfs-fuse must be installed.
Thanks but Eclipse won't work with this. I tried this already, that's why I was specifically asking about smbmount (a symbolic link to mount.cifs which is part of the smbfs package).
– Android Eve
Feb 1 '11 at 23:09
2
So eclipse can't access .gvfs in your home dir? As far as I know, every program should be able to do this. Correct me if I'm wrong.
– matthias.lukaszek
Feb 2 '11 at 9:23
add a comment
|
When using gnome, you can simply type in the smb:// url into Nautilus. Normally gvfs-fuse and other gvfs packages should be installed, so that you can mount samba directly with the file browser. Additionally you should find all mounted stuff in your ~/.gvfs folder. This even works with other protocols and compressed files etc.
gvfs-mount smb://user@server/storage
I've tested it with eclipse and other tools and it works. gvfs-fuse must be installed.
When using gnome, you can simply type in the smb:// url into Nautilus. Normally gvfs-fuse and other gvfs packages should be installed, so that you can mount samba directly with the file browser. Additionally you should find all mounted stuff in your ~/.gvfs folder. This even works with other protocols and compressed files etc.
gvfs-mount smb://user@server/storage
I've tested it with eclipse and other tools and it works. gvfs-fuse must be installed.
edited Feb 2 '11 at 10:00
answered Feb 1 '11 at 22:27
matthias.lukaszekmatthias.lukaszek
1887 bronze badges
1887 bronze badges
Thanks but Eclipse won't work with this. I tried this already, that's why I was specifically asking about smbmount (a symbolic link to mount.cifs which is part of the smbfs package).
– Android Eve
Feb 1 '11 at 23:09
2
So eclipse can't access .gvfs in your home dir? As far as I know, every program should be able to do this. Correct me if I'm wrong.
– matthias.lukaszek
Feb 2 '11 at 9:23
add a comment
|
Thanks but Eclipse won't work with this. I tried this already, that's why I was specifically asking about smbmount (a symbolic link to mount.cifs which is part of the smbfs package).
– Android Eve
Feb 1 '11 at 23:09
2
So eclipse can't access .gvfs in your home dir? As far as I know, every program should be able to do this. Correct me if I'm wrong.
– matthias.lukaszek
Feb 2 '11 at 9:23
Thanks but Eclipse won't work with this. I tried this already, that's why I was specifically asking about smbmount (a symbolic link to mount.cifs which is part of the smbfs package).
– Android Eve
Feb 1 '11 at 23:09
Thanks but Eclipse won't work with this. I tried this already, that's why I was specifically asking about smbmount (a symbolic link to mount.cifs which is part of the smbfs package).
– Android Eve
Feb 1 '11 at 23:09
2
2
So eclipse can't access .gvfs in your home dir? As far as I know, every program should be able to do this. Correct me if I'm wrong.
– matthias.lukaszek
Feb 2 '11 at 9:23
So eclipse can't access .gvfs in your home dir? As far as I know, every program should be able to do this. Correct me if I'm wrong.
– matthias.lukaszek
Feb 2 '11 at 9:23
add a comment
|
man mount
will help you determine what options you want. If the windows system will always be available. You can just add the mount to the /etc/fstab
and it will be mounted. You can allow the user to mount and unmount the partition as required using the options user,noauto
. To allow others to unmount it change user
to users
.
Autofs also supports on demand mounts using samba. The incantation depends on which directories you want mounted when. I've run it successfully in a development environment.
EDIT: If you need to do this for a lot of users, I suggest using autofs to do the mounting. This does not require changes to fstab. Obtaining credentials for the various users may be a problem. I use a directory structure in the form /net/$HOST/$USER
for my mounts. Autofs is configured for the /net/$HOST
portion of the mount and automatically mounts the directories under it as needed.
Particular mounting approaches depend on your needs. I have had cases where users needed their Desktop directory mounted on the server, although typical mounts are server based.
For large organization with lots of user it may make sense to move the directories to a Linux server and use Samba to share the files to Windows users. I haven't tried the reverse, but it may be possible.
This works, but you need root access to change fstab. Even if are root, note that it is quite impractical if you have to do it for a lot of users, each with a specific share to mount (as in a large organization where each user has a personal share in a centralized file server).
– user46513
Feb 15 '12 at 13:11
add a comment
|
man mount
will help you determine what options you want. If the windows system will always be available. You can just add the mount to the /etc/fstab
and it will be mounted. You can allow the user to mount and unmount the partition as required using the options user,noauto
. To allow others to unmount it change user
to users
.
Autofs also supports on demand mounts using samba. The incantation depends on which directories you want mounted when. I've run it successfully in a development environment.
EDIT: If you need to do this for a lot of users, I suggest using autofs to do the mounting. This does not require changes to fstab. Obtaining credentials for the various users may be a problem. I use a directory structure in the form /net/$HOST/$USER
for my mounts. Autofs is configured for the /net/$HOST
portion of the mount and automatically mounts the directories under it as needed.
Particular mounting approaches depend on your needs. I have had cases where users needed their Desktop directory mounted on the server, although typical mounts are server based.
For large organization with lots of user it may make sense to move the directories to a Linux server and use Samba to share the files to Windows users. I haven't tried the reverse, but it may be possible.
This works, but you need root access to change fstab. Even if are root, note that it is quite impractical if you have to do it for a lot of users, each with a specific share to mount (as in a large organization where each user has a personal share in a centralized file server).
– user46513
Feb 15 '12 at 13:11
add a comment
|
man mount
will help you determine what options you want. If the windows system will always be available. You can just add the mount to the /etc/fstab
and it will be mounted. You can allow the user to mount and unmount the partition as required using the options user,noauto
. To allow others to unmount it change user
to users
.
Autofs also supports on demand mounts using samba. The incantation depends on which directories you want mounted when. I've run it successfully in a development environment.
EDIT: If you need to do this for a lot of users, I suggest using autofs to do the mounting. This does not require changes to fstab. Obtaining credentials for the various users may be a problem. I use a directory structure in the form /net/$HOST/$USER
for my mounts. Autofs is configured for the /net/$HOST
portion of the mount and automatically mounts the directories under it as needed.
Particular mounting approaches depend on your needs. I have had cases where users needed their Desktop directory mounted on the server, although typical mounts are server based.
For large organization with lots of user it may make sense to move the directories to a Linux server and use Samba to share the files to Windows users. I haven't tried the reverse, but it may be possible.
man mount
will help you determine what options you want. If the windows system will always be available. You can just add the mount to the /etc/fstab
and it will be mounted. You can allow the user to mount and unmount the partition as required using the options user,noauto
. To allow others to unmount it change user
to users
.
Autofs also supports on demand mounts using samba. The incantation depends on which directories you want mounted when. I've run it successfully in a development environment.
EDIT: If you need to do this for a lot of users, I suggest using autofs to do the mounting. This does not require changes to fstab. Obtaining credentials for the various users may be a problem. I use a directory structure in the form /net/$HOST/$USER
for my mounts. Autofs is configured for the /net/$HOST
portion of the mount and automatically mounts the directories under it as needed.
Particular mounting approaches depend on your needs. I have had cases where users needed their Desktop directory mounted on the server, although typical mounts are server based.
For large organization with lots of user it may make sense to move the directories to a Linux server and use Samba to share the files to Windows users. I haven't tried the reverse, but it may be possible.
edited Feb 16 '12 at 0:26
answered Feb 2 '11 at 3:23
BillThor BillThor
4,10112 silver badges19 bronze badges
4,10112 silver badges19 bronze badges
This works, but you need root access to change fstab. Even if are root, note that it is quite impractical if you have to do it for a lot of users, each with a specific share to mount (as in a large organization where each user has a personal share in a centralized file server).
– user46513
Feb 15 '12 at 13:11
add a comment
|
This works, but you need root access to change fstab. Even if are root, note that it is quite impractical if you have to do it for a lot of users, each with a specific share to mount (as in a large organization where each user has a personal share in a centralized file server).
– user46513
Feb 15 '12 at 13:11
This works, but you need root access to change fstab. Even if are root, note that it is quite impractical if you have to do it for a lot of users, each with a specific share to mount (as in a large organization where each user has a personal share in a centralized file server).
– user46513
Feb 15 '12 at 13:11
This works, but you need root access to change fstab. Even if are root, note that it is quite impractical if you have to do it for a lot of users, each with a specific share to mount (as in a large organization where each user has a personal share in a centralized file server).
– user46513
Feb 15 '12 at 13:11
add a comment
|
I found this question while researching the magic I performed recently to do exactly this for one of my users. My workflow differs remarkably to the other answers. Do note, however, this is about the most simple case possible.
Assuming your username is ae
and your home is /home/ae
1) Set up smbfs:mkdir /home/ae/.smb
1a) If windows login credentials are needed, create and edit the file: /home/ae/.smb/smbnetfs.conf
to have contents:
auth winuser "winpassword"
winuser
is the user created on the Windows computer you wish to access. winpassword
is that user's password to log in to Windows on that computer.
2) Create your mount point:mkdir /home/ae/nethood
3) Execute the smbnetfs command:smbnetfs /home/ae/nethood
Note the entire "network neighborhood" will show up under /home/ae/nethood
with the workgroups being the first layer of subdirectories.
All of the listings below were copied from my browsing of folders as a non privileged user on an ubuntu host. Username and group changed to ae
. sudo
was never used. The Windows computers are on informal Windows network and shared folders are user/password protected (on the Windows computer using the windows username and password).
$ cd nethood
$ ls -alh
total 12K
drwxrwxrwx 9 ae ae 0 Dec 31 1969 .
drwxr-xr-x 9 ae ae 21 Jul 28 11:49 ..
drwxrwxrwx 2 root root 0 Dec 31 1969 WORKGROUP
Browse the workgroup WORKGROUP
:
$ cd WORKGROUP
$ ls -alh
total 0
drwxrwxrwx 2 root root 0 Dec 31 1969 .
drwxrwxrwx 9 root root 0 Dec 31 1969 ..
lrwxrwxrwx 1 root root 11 Dec 31 1969 HTPC -> ../HTPC
lrwxrwxrwx 1 root root 14 Dec 31 1969 NEWPC -> ../NEWPC
Change directory to computers and any shared folders will be listed and accessed as normal.
$ cd NEWPC
$ ls -alh
total 0
drwxrwxrwx 2 root root 0 Dec 31 1969 .
drwxrwxrwx 9 root root 0 Dec 31 1969 ..
drwxrwxrwx 2 root root 0 Dec 31 1969 Desktop
drwxrwxrwx 2 root root 0 Dec 31 1969 Users
And the files:
$ cd Desktop/
$ ls -alh
ls: cannot access desktop.ini: No such file or directory
total 30M
drwxrwxrwx 2 root root 0 Dec 31 1969 .
drwxrwxrwx 2 root root 0 Dec 31 1969 ..
-rwxr--r-- 1 ae ae 1.5K Jan 25 2013 Command Prompt.lnk
-????????? ? ? ? ? ? desktop.ini
-rwxr--r-- 1 ae ae 156K May 28 2013 Download %25285%2529.iif
-rwxr--r-- 1 ae ae 2.4K Jul 24 12:28 Google Chrome.lnk
-rwxr--r-- 1 ae ae 178 Feb 4 2013 import orders.bat
-rwxr--r-- 1 ae ae 2.3M Mar 30 2012 msvc2008_x86_vcredist_x64.exe
drwxr-xr-x 2 ae ae 0 May 20 2014 OpenOffice 4.1.0 (en-US) Installation Files
-rwxr--r-- 1 ae ae 406K Jun 6 2013 Paypal_Jan_1_2012_to_Dec_31_2012.iif
-rwxr--r-- 1 ae ae 15M May 8 2012 php-5.4.3-Win32-VC9-x86.zip
-rwxr--r-- 1 ae ae 1.9K Jul 24 13:03 PSPad.lnk
-rwxr--r-- 1 ae ae 1.1K Jul 24 12:31 VB Demo.lnk
Notice the above directories have ownership root root
. File ownership will be the same as your user.
No other users will be able to access the folders regardless of the mount point or that folder's ownership or permissions. If your user can "write" to that folder (and it is empty), smbnetfs will mount the network neighborhood there and not allow anyone else access, even root
. For root
to have access, you must su ae
.
If there are no shared folders, the computer's directory will be empty.
If you do not have credentials to the Windows computer, you may get the error:ls: cannot open directory .: Input/output error
add a comment
|
I found this question while researching the magic I performed recently to do exactly this for one of my users. My workflow differs remarkably to the other answers. Do note, however, this is about the most simple case possible.
Assuming your username is ae
and your home is /home/ae
1) Set up smbfs:mkdir /home/ae/.smb
1a) If windows login credentials are needed, create and edit the file: /home/ae/.smb/smbnetfs.conf
to have contents:
auth winuser "winpassword"
winuser
is the user created on the Windows computer you wish to access. winpassword
is that user's password to log in to Windows on that computer.
2) Create your mount point:mkdir /home/ae/nethood
3) Execute the smbnetfs command:smbnetfs /home/ae/nethood
Note the entire "network neighborhood" will show up under /home/ae/nethood
with the workgroups being the first layer of subdirectories.
All of the listings below were copied from my browsing of folders as a non privileged user on an ubuntu host. Username and group changed to ae
. sudo
was never used. The Windows computers are on informal Windows network and shared folders are user/password protected (on the Windows computer using the windows username and password).
$ cd nethood
$ ls -alh
total 12K
drwxrwxrwx 9 ae ae 0 Dec 31 1969 .
drwxr-xr-x 9 ae ae 21 Jul 28 11:49 ..
drwxrwxrwx 2 root root 0 Dec 31 1969 WORKGROUP
Browse the workgroup WORKGROUP
:
$ cd WORKGROUP
$ ls -alh
total 0
drwxrwxrwx 2 root root 0 Dec 31 1969 .
drwxrwxrwx 9 root root 0 Dec 31 1969 ..
lrwxrwxrwx 1 root root 11 Dec 31 1969 HTPC -> ../HTPC
lrwxrwxrwx 1 root root 14 Dec 31 1969 NEWPC -> ../NEWPC
Change directory to computers and any shared folders will be listed and accessed as normal.
$ cd NEWPC
$ ls -alh
total 0
drwxrwxrwx 2 root root 0 Dec 31 1969 .
drwxrwxrwx 9 root root 0 Dec 31 1969 ..
drwxrwxrwx 2 root root 0 Dec 31 1969 Desktop
drwxrwxrwx 2 root root 0 Dec 31 1969 Users
And the files:
$ cd Desktop/
$ ls -alh
ls: cannot access desktop.ini: No such file or directory
total 30M
drwxrwxrwx 2 root root 0 Dec 31 1969 .
drwxrwxrwx 2 root root 0 Dec 31 1969 ..
-rwxr--r-- 1 ae ae 1.5K Jan 25 2013 Command Prompt.lnk
-????????? ? ? ? ? ? desktop.ini
-rwxr--r-- 1 ae ae 156K May 28 2013 Download %25285%2529.iif
-rwxr--r-- 1 ae ae 2.4K Jul 24 12:28 Google Chrome.lnk
-rwxr--r-- 1 ae ae 178 Feb 4 2013 import orders.bat
-rwxr--r-- 1 ae ae 2.3M Mar 30 2012 msvc2008_x86_vcredist_x64.exe
drwxr-xr-x 2 ae ae 0 May 20 2014 OpenOffice 4.1.0 (en-US) Installation Files
-rwxr--r-- 1 ae ae 406K Jun 6 2013 Paypal_Jan_1_2012_to_Dec_31_2012.iif
-rwxr--r-- 1 ae ae 15M May 8 2012 php-5.4.3-Win32-VC9-x86.zip
-rwxr--r-- 1 ae ae 1.9K Jul 24 13:03 PSPad.lnk
-rwxr--r-- 1 ae ae 1.1K Jul 24 12:31 VB Demo.lnk
Notice the above directories have ownership root root
. File ownership will be the same as your user.
No other users will be able to access the folders regardless of the mount point or that folder's ownership or permissions. If your user can "write" to that folder (and it is empty), smbnetfs will mount the network neighborhood there and not allow anyone else access, even root
. For root
to have access, you must su ae
.
If there are no shared folders, the computer's directory will be empty.
If you do not have credentials to the Windows computer, you may get the error:ls: cannot open directory .: Input/output error
add a comment
|
I found this question while researching the magic I performed recently to do exactly this for one of my users. My workflow differs remarkably to the other answers. Do note, however, this is about the most simple case possible.
Assuming your username is ae
and your home is /home/ae
1) Set up smbfs:mkdir /home/ae/.smb
1a) If windows login credentials are needed, create and edit the file: /home/ae/.smb/smbnetfs.conf
to have contents:
auth winuser "winpassword"
winuser
is the user created on the Windows computer you wish to access. winpassword
is that user's password to log in to Windows on that computer.
2) Create your mount point:mkdir /home/ae/nethood
3) Execute the smbnetfs command:smbnetfs /home/ae/nethood
Note the entire "network neighborhood" will show up under /home/ae/nethood
with the workgroups being the first layer of subdirectories.
All of the listings below were copied from my browsing of folders as a non privileged user on an ubuntu host. Username and group changed to ae
. sudo
was never used. The Windows computers are on informal Windows network and shared folders are user/password protected (on the Windows computer using the windows username and password).
$ cd nethood
$ ls -alh
total 12K
drwxrwxrwx 9 ae ae 0 Dec 31 1969 .
drwxr-xr-x 9 ae ae 21 Jul 28 11:49 ..
drwxrwxrwx 2 root root 0 Dec 31 1969 WORKGROUP
Browse the workgroup WORKGROUP
:
$ cd WORKGROUP
$ ls -alh
total 0
drwxrwxrwx 2 root root 0 Dec 31 1969 .
drwxrwxrwx 9 root root 0 Dec 31 1969 ..
lrwxrwxrwx 1 root root 11 Dec 31 1969 HTPC -> ../HTPC
lrwxrwxrwx 1 root root 14 Dec 31 1969 NEWPC -> ../NEWPC
Change directory to computers and any shared folders will be listed and accessed as normal.
$ cd NEWPC
$ ls -alh
total 0
drwxrwxrwx 2 root root 0 Dec 31 1969 .
drwxrwxrwx 9 root root 0 Dec 31 1969 ..
drwxrwxrwx 2 root root 0 Dec 31 1969 Desktop
drwxrwxrwx 2 root root 0 Dec 31 1969 Users
And the files:
$ cd Desktop/
$ ls -alh
ls: cannot access desktop.ini: No such file or directory
total 30M
drwxrwxrwx 2 root root 0 Dec 31 1969 .
drwxrwxrwx 2 root root 0 Dec 31 1969 ..
-rwxr--r-- 1 ae ae 1.5K Jan 25 2013 Command Prompt.lnk
-????????? ? ? ? ? ? desktop.ini
-rwxr--r-- 1 ae ae 156K May 28 2013 Download %25285%2529.iif
-rwxr--r-- 1 ae ae 2.4K Jul 24 12:28 Google Chrome.lnk
-rwxr--r-- 1 ae ae 178 Feb 4 2013 import orders.bat
-rwxr--r-- 1 ae ae 2.3M Mar 30 2012 msvc2008_x86_vcredist_x64.exe
drwxr-xr-x 2 ae ae 0 May 20 2014 OpenOffice 4.1.0 (en-US) Installation Files
-rwxr--r-- 1 ae ae 406K Jun 6 2013 Paypal_Jan_1_2012_to_Dec_31_2012.iif
-rwxr--r-- 1 ae ae 15M May 8 2012 php-5.4.3-Win32-VC9-x86.zip
-rwxr--r-- 1 ae ae 1.9K Jul 24 13:03 PSPad.lnk
-rwxr--r-- 1 ae ae 1.1K Jul 24 12:31 VB Demo.lnk
Notice the above directories have ownership root root
. File ownership will be the same as your user.
No other users will be able to access the folders regardless of the mount point or that folder's ownership or permissions. If your user can "write" to that folder (and it is empty), smbnetfs will mount the network neighborhood there and not allow anyone else access, even root
. For root
to have access, you must su ae
.
If there are no shared folders, the computer's directory will be empty.
If you do not have credentials to the Windows computer, you may get the error:ls: cannot open directory .: Input/output error
I found this question while researching the magic I performed recently to do exactly this for one of my users. My workflow differs remarkably to the other answers. Do note, however, this is about the most simple case possible.
Assuming your username is ae
and your home is /home/ae
1) Set up smbfs:mkdir /home/ae/.smb
1a) If windows login credentials are needed, create and edit the file: /home/ae/.smb/smbnetfs.conf
to have contents:
auth winuser "winpassword"
winuser
is the user created on the Windows computer you wish to access. winpassword
is that user's password to log in to Windows on that computer.
2) Create your mount point:mkdir /home/ae/nethood
3) Execute the smbnetfs command:smbnetfs /home/ae/nethood
Note the entire "network neighborhood" will show up under /home/ae/nethood
with the workgroups being the first layer of subdirectories.
All of the listings below were copied from my browsing of folders as a non privileged user on an ubuntu host. Username and group changed to ae
. sudo
was never used. The Windows computers are on informal Windows network and shared folders are user/password protected (on the Windows computer using the windows username and password).
$ cd nethood
$ ls -alh
total 12K
drwxrwxrwx 9 ae ae 0 Dec 31 1969 .
drwxr-xr-x 9 ae ae 21 Jul 28 11:49 ..
drwxrwxrwx 2 root root 0 Dec 31 1969 WORKGROUP
Browse the workgroup WORKGROUP
:
$ cd WORKGROUP
$ ls -alh
total 0
drwxrwxrwx 2 root root 0 Dec 31 1969 .
drwxrwxrwx 9 root root 0 Dec 31 1969 ..
lrwxrwxrwx 1 root root 11 Dec 31 1969 HTPC -> ../HTPC
lrwxrwxrwx 1 root root 14 Dec 31 1969 NEWPC -> ../NEWPC
Change directory to computers and any shared folders will be listed and accessed as normal.
$ cd NEWPC
$ ls -alh
total 0
drwxrwxrwx 2 root root 0 Dec 31 1969 .
drwxrwxrwx 9 root root 0 Dec 31 1969 ..
drwxrwxrwx 2 root root 0 Dec 31 1969 Desktop
drwxrwxrwx 2 root root 0 Dec 31 1969 Users
And the files:
$ cd Desktop/
$ ls -alh
ls: cannot access desktop.ini: No such file or directory
total 30M
drwxrwxrwx 2 root root 0 Dec 31 1969 .
drwxrwxrwx 2 root root 0 Dec 31 1969 ..
-rwxr--r-- 1 ae ae 1.5K Jan 25 2013 Command Prompt.lnk
-????????? ? ? ? ? ? desktop.ini
-rwxr--r-- 1 ae ae 156K May 28 2013 Download %25285%2529.iif
-rwxr--r-- 1 ae ae 2.4K Jul 24 12:28 Google Chrome.lnk
-rwxr--r-- 1 ae ae 178 Feb 4 2013 import orders.bat
-rwxr--r-- 1 ae ae 2.3M Mar 30 2012 msvc2008_x86_vcredist_x64.exe
drwxr-xr-x 2 ae ae 0 May 20 2014 OpenOffice 4.1.0 (en-US) Installation Files
-rwxr--r-- 1 ae ae 406K Jun 6 2013 Paypal_Jan_1_2012_to_Dec_31_2012.iif
-rwxr--r-- 1 ae ae 15M May 8 2012 php-5.4.3-Win32-VC9-x86.zip
-rwxr--r-- 1 ae ae 1.9K Jul 24 13:03 PSPad.lnk
-rwxr--r-- 1 ae ae 1.1K Jul 24 12:31 VB Demo.lnk
Notice the above directories have ownership root root
. File ownership will be the same as your user.
No other users will be able to access the folders regardless of the mount point or that folder's ownership or permissions. If your user can "write" to that folder (and it is empty), smbnetfs will mount the network neighborhood there and not allow anyone else access, even root
. For root
to have access, you must su ae
.
If there are no shared folders, the computer's directory will be empty.
If you do not have credentials to the Windows computer, you may get the error:ls: cannot open directory .: Input/output error
answered Jul 28 '15 at 22:16
Chris KChris K
2833 silver badges12 bronze badges
2833 silver badges12 bronze badges
add a comment
|
add a comment
|
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f24348%2fhow-do-i-mount-samba-share-as-non-root-user%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown