How to get Caja to work with Samba share? - linux-mint

So I'm trying to get Caja to work with a Samba share on another computer. This is what I have so far.
I've enabled SMB access to Caja
sudo apt-get install caja-share
I haven't been able to access the samba shared drive yet.

Ok, here goes, I need to install samba on the another computer.
sudo apt-get update
sudo apt-get install samba
Next add a samba user to the samba computer. This adds a user.
sudo smbpasswd -a comp1
Then enable the new user.
sudo smbpasswd -e comp1
Now you want to edit your samba configuration to enable Caja access.
sudo gedit /etc/samba/smb.conf
[global]
admin users = comp1
workgroup = WORKGROUP
server string = %h server (Samba, Ubuntu)
unix charset = UTF-8
server min protocol = NT1
ntlm auth = yes
client min protocol = NT1
client max protocol = SMB3
case sensitive = no
bind interfaces only = yes
Next edit the shared folder settings in the configuration.
[share]
path = /path/to/shared/folder
available = yes
#valid users = comp1
read only = yes
writeable = no
hosts allow = 192.168.1.2 192.168.1.3
hosts deny = 0.0.0.0/0
public = yes
browseable = yes
Finally restart Samba to have the changes take effect.
sudo systemctl restart smbd nmbd
You may have to allow Samba to work through your firewall.
sudo ufw allow samba
Once that's done, in your Caja browse the Network to find your shared drives. It should be accessible now.

Related

Thunar: Failed to open "smb://<address>": The specified location is not supported

I am trying to setup a NAS server on my raspberry pi which can be accessed by my home linux machine running Arch.
This is my config from /etc/samba/smb.conf on my raspberry pi
[Cloud Pi]
comment = Pi shared folder
path = /home/pi/Shared
browseable = yes
writeable = yes
public = yes
only guest = no
force user = root
force group = root
guest ok = yes
create mask = 0777
directory mask = 0777
read only = no
Ran the following command on my home linux machine to load the smb server
thunar smb://<IP address>
And was greeted with
Thunar: Failed to open "smb://<IP address>": The specified location is not supported
Turns out there were two things I was doing wrong.
No config file in home linux machine
I had downloaded the samba package from AUR. On further reading in their official homepage, they say that post-installation, we need to manually create a default config file at /etc/samba/smb.conf.
I copied the contents from here and pasted it in a new manually created /etc/samba/smb.conf file.
Missing dependencies for Thunar
The following packages were necessary to make it work in my case.
thunar-shares-plugin
gvfs-smb
After installing the dependencies, the first time I tried to open a file I had to login using my username & password I had used in my raspberry pi while setting up the samba server.
Since then, it works as expected.

CentOS 6.4 / Samba4 standalone server using OpenLDAP backend

I have a OpenLDAP server (v2.4) running on CentOS 6.4. It works great! I'm using this OpenLdap server as authenticate backend for several service like Gitlab, Redmine, etc.
Now I want to setup another Samba standalone server and use the OpenLDAP server as auth backend for existed users in OpenLDAP. I tried with samba v3.6.9 but after configure auth backend as ldapsam in smb.conf I can't login using LDAP account.
When I run
smbclient -L localhost -U%
Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.6.9-151.el6_4.1]
Sharename Type Comment
--------- ---- -------
allusers Disk All Users
IPC$ IPC IPC Service (Samba Server Version 3.6.9-151.el6_4.1)
Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.6.9-151.el6_4.1]
Server Comment
--------- -------
VAGRANT-CENTOS64 Samba Server Version 3.6.9-151.el6_4.1
Workgroup Master
--------- -------
WORKGROUP MY_MACHINE
But when I login with my test acc
smbclient -L localhost -U test
Enter test's password:
session setup failed: NT_STATUS_LOGON_FAILURE
Here is my /etc/samba/smb.conf (print out from testparm)
[global]
workgroup = MYGROUP
server string = Samba Server Version %v
passdb backend = ldapsam:ldap://192.168.1.201/
log file = /var/log/samba/log.%m
max log size = 50
ldap admin dn = cn=Manager,dc=mycompany,dc=com
ldap passwd sync = yes
ldap suffix = dc=mycompany,dc=com
ldap ssl = no
ldap debug level = 1
idmap config * : backend = tdb
cups options = raw
In the Samba server. I use sssd to authenticate with OpenLDAP. From this Samba machine I can query user by ldapsearch command. I can get the user info by id LDAP_USER and ssh to this machine by any LDAP_USER/password. Here is my /etc/sssd/sssd.conf
[domain/mycompany.com]
ldap_id_use_start_tls = False
cache_credentials = True
ldap_search_base = dc=mycompany,dc=com
id_provider = ldap
auth_provider = ldap
chpass_provider = ldap
ldap_uri = ldaps://192.168.1.201:636
ldap_tls_cacertdir = /etc/openldap/certs
ldap_tls_reqcert = never
[sssd]
services = nss, pam
config_file_version = 2
domains = mycompany.com
On OpenLDAP server, I use LDAP Account Manager to manage user/group. I import samba schema and check everything ok in LAM. I also enable samba3 extension for some users in LDAP to test. I also open ports 137, 138, 139, 445 (tcp) in Samba server.
So what should I do next?
I just want to reuse the user from OpenLDAP server. I don't want to create any user from samba. Please give me suggestions about this case.
Thank you!
You need to make sure samba knows the password of the admin DN to bind to LDAP server. This is done with
smbpasswd -w <secret>
before starting Samba.
Now, if that is done, do you have NTLM passwords created for your users? Samba checks sambaNTPassword and sambaLMPassword attributes when performing authentication for the user. For changing these attributes at the time user changes own password through LDAP, you need to use smbk5pwd OpenLDAP overlay and set ldap passwd sync = only in smb.conf instead of ldap passwd sync = yes as you did.
I don't know if you solved the problem. In any case if you install a samba 4 standalone server using a ldap remote server you have to establish the same SID that domain server (it's not necessary to join it to the domain). Obviously, the command net setlocalid <sid domain> won't work on a local machine. You have to modify the value in the LDAP tree, searching the name of the netbios machine... I recommend you use a LDAP browser for this purpose...
Good Luck

Resolve hostnames with arch linux on a RaspberryPi

I have a Pi that runs hostapd and dhcpd on arch linux to create it's own land with the Pi's (routers) IP being 10.0.0.1. This uses the wlan0 interface and it only serves as a standalone router running a web server.
Once I connect to the Pi, I use 10.0.0.1 to display the web pages, but I want to use a hostname such as firepi. I have tried using dnsmasq, but I haven't been successful. Any help would be greatly appreciated especially if you can give me some detailed examples as I am a novice.
The purpose of this system is that I have created a web app that you can use to ignite fireworks over WiFi at a safe distance. I would just like the convenience of using a hostname instead of the IP address.
I must add that I will more than likely be using an iPhone to connect to the server, should this affect anything.
Not too sure how or why but this is what I did and it is successfully working now, so this is just for future users who may need a similar setup to mine.
First I installed hostapd and dhcpd and made sure they were working. Next I changed '/etc/hostname' to firepi and the '/etc/hosts' and added '10.0.0.1 firepi'. Then I installed dnsmasq, and set the interface to wlan0, and finally added '10.0.0.1 firepi' to '/etc/resolv.conf'.
After a full reboot, I joined the network on my iPhone, navigated to firepi and sure enough, it worked!
Thanks to the other users for their advice and tips.
You can use avahi on Arch as well to resolve your hostname:
sudo pacman -S avahi nss-mdns
Start the avahi daemon:
sudo systemctl enable avahi-daemon.service
sudo systemctl start avahi-daemon.service
Edit /etc/nsswitch.conf
sudo vim /etc/nsswitch.conf
Change the line:
hosts: files myhostname dns
to
hosts: files myhostname mdns_minimal [NOTFOUND=return] dns
Reboot
Note: don't forget to add .local to your hostname.
See also:
http://blog.pixxis.be/post/77285636682/resolve-hostname-with-arch-linux-on-a-raspberry-pi
If you just want to be able to use "firepi" as hostname to connect to it, you can simply add it to your /etc/hosts file using the syntax "IP host".
To make it as easy as possible, run this command as root:
echo "10.0.0.1 firepi" >> /etc/hosts
That'll do the trick.
Can you try avahi ?
sudo apt-get install avahi-daemon and
sudo apt-get install avahi-browse
I've successfully used that on Raspian. Unless you change the hostname using
sudo raspi-config you will access via raspberrypi.local
Note that if you plan to access the RPi from Windows you will need to install Bonjour Service first(if you have iTunes intalled, you might have those, run services.msc and check if the Bonjour Service is started)
Another note: On a friend's iphone I've installed a generic vnc client and had x11vnc running on the RPi and succesfully managed to connect to the RPi (since avahi-daemon was installed)

How to share my remote samba connection for all local users?

Several guys in our office have accounts on local linux(ubuntu) workstation (named local-server). But Just I have the account to access the remote samba server (named remote-server).
For security, I can not tell other guys my account and password information. But I want to share my mount point for them.
For example, I mount remote samba server on this path: /home/samba/. I want everyone on local-server can read/write '/home/samba' directory and its sub-directory. (However, I don't want to modify the remote file's permission mode)
How can I configure it? Thank you very much!
You can set the uid/gid to be different and therefore allow other users to read/write to your share. First create a local group, e.g. shareaccess and assign it to your users:
sudo addgroup shareaccess
sudo usermod -a -G shareaccess user1
Then mount the share:
mount.cifs -ouid=youruser,forceuid,gid=shareaccess,forcegid,file_mode=770,dir_mode=770,credentials=/etc/secret-cred //server/share /home/samba
Files and directory will appear to be owned by youruser:shareaccess locally with permissions ug=rwx.
If the server is a Samba (not Windows) server too and has Unix extensions enabled, file and directory permissions are set according to the server. This might or might not be desirable. You can disable Unix extensions for the mount by adding the nounix option, which will force the modes to be the ones specified at mount-time. Be aware that this will disable all Unix extensions, e.g. symlink support.
References:
mount.cifs man page
if you want to re-attach your mounted samba network shares, you can use the following:
sudo mount -a

I can ping my centOS virtual machine but I cant access its shared folders

so this is the setup:
I have a Windows XP installed, VirtualBox and a centOS 6.2 virtual machine.
I installed Samba, and currently, my VM and host Windows are in the same subnet.
I can ping my VM from Windows and vice versa.
I have a created a shared folder via Samba like this:
[Share]
path = /home/share
writable = yes
guest ok = yes
guest only = yes
create mode = 0777
directory mode = 0777
share modes = yes
*I followed a full tutorial here
My problem now is that, when I try to access such folder like this \192.xx.xxx.xxx\home\share (192.xx.xxx.xxx is the IP address of my VM) from Windows "Run",
Windows can't find it.
P.S. I've turned off my Windows Firewall (although Trend Micro personal firewall is still on)
found the solution, I changed the iptables, and smb.conf to allow my Host IP address to access my guest. Thanks anyway :)