I assume samba is already initialized.
Guest access
We want everybody to be able to store files there, and everybody to be able to read them. So let's give guest access to it. But somebody has to be the owner of the files, right? (In terms of Unix file ownership, chown). So we neet to tell who guest user maps to. Lets call our Unix user henry:
sudo adduser henrySet some password too.
Now, let's tell samba that guest should map to henry. In /etc/samba/smb.conf in [global] section:
guest account = henryWe are ready to create share for everybody now. Again, in /etc/samba/smb.conf:
[for-all] path = /home/henry browsable = yes read only = no guest ok = yes create mask = 644Now we created share called "for-all", it is stored at /home/henry, and everybody can read and write it. Files put to server into for-all share are going to be read-write for owner (henry), and read for everyone. However, it is not so important as everybody can access them like owner through samba.
Users access
We can also make it available only for users. Let's say we want samba user henry:
sudo smbpasswd -a henrySet password. User created.
Now we need to disable guest access:
guest ok = noNow we can connect from another machine by smbclient:
smbclient //192.168.1.1/for-all -U henryOf course put your server's IP instead of 192.168.1.1
Mount as fs for users manually
You can mount samba share to some directory on your client machine. Just like some filesystem. Install smbfs package:
sudo apt-get install smbfsIf you have sudo access, you can mount samba share. First, create directory to mount it:
mkdir smb-shareNow, mount share:
sudo mount -t cifs //192.168.1.1/for-all smb-share -o username=henry,noexec,uid=local_user,gid=local_groupnoexec means you'll be not able to run any executable files from that share. uid and gid will render all files in mounted share to belong to user local_user and group local_group on client.
If you want more users to be able to mount the share, you can create group for them:
sudo addgroup sambaNow let's give this group rights to mount remote samba shares. Run:
sudo visudoAnd in the group section add following line:
%samba ALL=(ALL) /bin/mount,/bin/umount,/sbin/mount.cifs,/sbin/umount.cifsAdd user frank to that group:
sudo adduser frank sambaFrom now on, frank can mount samba shares.
2 comments:
your blog is slowly becoming my reference when configuring my linux server
thx for the post about postfix :)
I put all this here to be my own reference. If it is useful for somebody else, it's great and I'm glad :)
Post a Comment