Linux how do i access nas/samba

edogg

Inactive User
Joined
Feb 24, 2006
Messages
4,055
Reaction score
723
Hi next step in my Raspberry pi after installing sickbeard sabnzb getting them to run on startup and then installing XBMC . I have now installed SAMBA to use it as a NAS drive it seems to be working but I dont know how to connect to it I followed these steps
sudo apt-get install samba
mkdir /mnt/share
add the following line to /etc/fstab:
/dev/sda1 /mnt/share ext4 defaults 0 0
sudo mount /mnt/share
I already had this hdd mounted so I got the reply to that effect

sudo chown -R root:users /mnt/share
sudo chmod -R ug+rwx /mnt/share

to create a user account
sudo useradd smbaccess -m -G users
sudo passwd smbaccess
sudo smbpasswd -a smbaccess

ask Samba to share the mount point over the network, and this can be done by adding the following to the end of /etc/samba/smb.conf:
[public]
comment = Public
path = /mnt/share
valid users = @users
force group = users
create mask = 0660
directory mask = 0771
read only = no
I then restarted samba
sudo service samba restart

my question is how do i now access the files from
(a) windows laptop
(b) a VU+DUO this has samba installed

any help please I can see the mnt/ share folder in the raspberry's file manager
 
On windows. you should be able to access it from the share name so:

\\192.168.0.x\Share

or from the command line NET USE driveletter: \\192.168.0.x\share /user:username password /persistent:Yes

If you can't you probably need to change the authentication level (NTLM)

Make sure SMB/CIFS are allowed through the firewall (Linux)
 
Last edited:
Check the Global settings in you smb.conf file:

[global]
lanman auth = yes
netbios name = alselbsv002 # Samba NetBIOS name
server string = Ubuntu
default = shared # Optional
client ntlmv2 auth = yes
workgroup = AALAND
ntlm auth = yes
os level = 20
encrypt passwords = true # Required
security = user
preferred master = yes # Optional

Ideally, don't use /mnt as it is intended for making file systems visible to the Pi system rather than your PC. There's nothing to mount at the Pi end. You may want to do something similar to this in the share details in smb.conf:

[shared]
writeable = yes
wide links = no # Optional
path = /data/shared
force directory mode = 775
force group = users # Replace with your Group
force create mode = 775
force user = user1 # Replace with your User
comment = Shared
create mode = 775
public = no # Or omit
guest = no # Or omit
directory mode = 775

Proceed as Exos described using the smbaccess user and password you created in your OP.

More documentation here.

Once that's good the Duo should be straightforward - this time mount in /mnt and once it's good put an entry in fstab to make it permanent.
 
I done sudo nano etc/samba/smb.conf and added the lines from above so now the duo has registered the raspberry but I can't see any files in either the shared or public CIFS
I had no luck with windows at all just cannot access the drive at all
 
Last edited:
ok it includes all the above text that you suggested plus :-

[global]
lanman auth = yes
netbios name = alselbsv002[shared]
writeable = yes
wide links = no # Optional
path = /data/shared
force directory mode = 775
force group = users # Replace with your Group
force create mode = 775
force user = user1 # Replace with your User
comment = Shared
create mode = 775
public = no # Or omit
guest = no # Or omit
directory mode = 775 # Samba NetBIOS name
server string = Ubuntu
default = shared # Optional
client ntlmv2 auth = yes
workgroup = WORKGROUP
ntlm auth = yes
os level = 20
encrypt passwords = true # Required
security = user
preferred master = yes # Optional

[shared]
writeable = yes
wide links = no # Optional
path = /data/shared
force directory mode = 775
force group = users # Replace with your Group
force create mode = 775
force user = user1 # Replace with your User
comment = Shared
create mode = 775
public = no # Or omit
guest = no # Or omit
directory mode = 775

[public]
comment = Public
path = /mnt/share
valid users = @users
force group = users
create mask = 0660
directory mask = 0771
read only = no

thanks for your help I dont know what this means as I am just copy/pasting it my groups are pi adm dialout cdrom sudo audio video plugdev games users netdev input indiecity
 
Last edited:
ok it includes all the above text that you suggested plus :-

Your smb.conf is all muxed ip...

[global]
lanman auth = yes # enables layman authentication
netbios name = alselbsv002 # the server name your Samba server appears as over the network

[shared] # the start of the configuration for your share named 'shared'
writeable = yes # the share cane be written to
wide links = no # Optional
path = /data/shared # the directory on the Raspberry Pi that is shared under Samba
force directory mode = 775 # directory permissions are 775
force group = users # Replace with your Group
force create mode = 775 # Create files with 775 permissions
force user = user1 # Replace with your User
comment = Shared # Optional
create mode = 775 # Create files with 775 permissions
public = no # Or omit
guest = no # Or omit
directory mode = 775 # optional
server string = Ubuntu # Should be in the Global section
default = shared # Should be in the Global section
client ntlmv2 auth = yes # Use ntlmv2 authentication, should be in Global section
workgroup = WORKGROUP # should be in Global section
ntlm auth = yes # Should be in Global section
os level = 20 # should be in Global section
encrypt passwords = true # Required, should be in Global section
security = user # Should be in Global section
preferred master = yes # Optional, should be in Global section

[shared]
writeable = yes # users group can write this
wide links = no # Optional
path = /data/shared # the directory on the Rasberry Pi that you shared
force directory mode = 775 # force the permissions on the directory you shared to be 775
force group = users # Replace with your Group so that anyone in his group can access the share
force create mode = 775 # Make sure any files/directories are created with the correct permissions
force user = user1 # Replace with your User
comment = Shared # Optional
create mode = 775 # Unforced, normally create files/directories with 775 permissions
public = no # Or omit
guest = no # Or omit
directory mode = 775 #Unforced, normally create directories with 775 permissions

The next bit is yours, change to match the above to allow access...

[public]
comment = Public
path = /mnt/share
valid users = @users
force group = users
create mask = 0660
directory mask = 0771
read only = no

thanks for your help I dont know what this means as I am just copy/pasting it my groups are pi adm dialout cdrom sudo audio video plugdev games users netdev input indiecity

I have to add this bit to keep the forum happy!
 
thanks for that . when I copied and paste it is obvious that I mixed the lines up I have used path = /mnt/share #because that is where my tv downloads will be put by sabtosickbeard which is what I am trying to share in case xbmc doesn't work well. How would i change the usb drive to data instead of mnt as it appears in /mnt/share if every thing else works as it should
 
How would i change the usb drive to data instead of mnt as it appears in /mnt/share if every thing else works as it should

I hadn't realised you were sharing auto-mounted data - I'd leave it where it is :)
 
this doin my head in now I copied all the text from him her into a new smb.conf file and the duo can find the raspberrypi and mount it but I cant see the usb drive and window just keeps not finding the raspberrypi on the network
 
There's likely a few issues there so I would break it down:

1 - can you see the files in the Pi filesystem when the USB mounts?
2 - can you change permissions, add and remove files etc?
3 - can the duo see the files?

Find the point it all breaks then I would install Webmin on the Pi to make configuration easier

You can get Webmin install instructions here - Webmin is a browser-based Linux configuration tool. Scroll down to the 'andrea1388 Sep 04' comment and do that - you don't need Apache for Webmin!

Take the pain away :)
 
Last edited:
There's likely a few issues there so I would break it down:

1 - can you see the files in the Pi filesystem when the USB mounts? yes it shows under /media/drivename the other partitions also show up under places because I have been using them
2 - can you change permissions, add and remove files etc? yes I can do that by right click menu
3 - can the duo see the files?NO it now sees the raspberrypi as 192.168.0.* (_MSBROWSE_)

Find the point it all breaks then I would install Webmin on the Pi to make configuration easier

You can get Webmin install instructions here - Webmin is a browser-based Linux configuration tool. Scroll down to the 'andrea1388 Sep 04' comment and do that - you don't need Apache for Webmin!

Take the pain away :)

I think I will try that all this is just to stop my brain atrophying but I am slowly going mad anyway
 
I have got webmin and the first thing is there are loads of updates even though I had to do sudo apt-get update before I could install webmin I will look at webmin when the updates are finished I take I need the networking or servers ? to get the nas working
 
In the Servers section are all the configuration options you need in a nice browser interface :)

samba.png
 
Hopefully I will be able to get it working with that before I lose the rest of my brain cells I am still getting updates so I am going to let it finish
 
Hopefully I will be able to get it working with that before I lose the rest of my brain cells I am still getting updates so I am going to let it finish
this just proves I really don't know what I am doing still no luck with seeing files on the duo and windows just refuses to recognise it is on my network
 
this just proves I really don't know what I am doing

We knew that! Sorry, no offence...

...break it down into bits. On the Pi, do 'sudo smbclient -L localhost' and post the results - tells us what the Samba server thinks it's doing. Then, lets take a look at what smb.conf has in it now. Also, what version of Windows do you have? Samba version?

We can crack this M8 :)
 
this is what that says
Unknown parameter encountered: "hosts equiv"
Ignoring unknown parameter "hosts equiv"
Enter root's password:
Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.6.6]

Sharename Type Comment
--------- ---- -------
print$ Disk Printer Drivers
shared Disk Shared
public Disk shared
IPC$ IPC IPC Service (raspberrypi server)
Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.6.6]

Server Comment
--------- -------
ALSELBSV002 # SA raspberrypi server
RASPBERRYPI raspberrypi server

Workgroup Master
--------- -------
KODAKAIO EKDEF75305
VIX VUDUO
WORKGROUP ALSELBSV002 # SAMBA NETBIOS NAME

server string = %h server
path = /mnt/share
unix password sync = yes
workgroup = WORKGROUP
os level = 20
syslog = 0
security = user
preferred master = yes
panic action = /usr/share/samba/panic-action %d
usershare allow guests = yes
max log size = 1000
pam password change = yes

[shared]
writeable = yes
wide links = no # Optional
path = /mnt/share
force directory mode = 775
force group = pi # Replace with your Group
force create mode = 775
force user = pi # Replace with your User
comment = Shared
create mode = 775
public = no # Or omit
guest = no # Or omit
directory mode = 775

[public]
comment = shared
path = /mnt/share
valid users = @users
force group = pi
create mask = 0660
directory mask = 0771
read only = no

windows 7
samba 3.6.6

copy and paste is a wonderful invention thanks again for helping
 
Last edited:
Not sure were you got your smb.conf but all you'd really need was:

comment = shared
browsable = yes
path = /mnt/share
public = yes
writable = yes
guest ok = yes

service samba restart and give it another go.
 
There's more in it than there needs to be but you'll need a bit more than Rezyn suggests.

Copy it to a backup then put this basic one in place:

[global]
workgroup = WORKGROUP
netbios name = RASPBERRYPI

[public]
comment = shared
browsable = yes
path = /mnt/share
public = yes
writable = yes
guest ok = yes

Restart Samba and you should see RASPBERRYPI in the WORKGROUP with a single share. The Duo should see this but Windows will need a bit more work if it's Vista or newer.
 
Back
Top