[solved ] access a SAMBA network folder

Post here if you are a new Porteus member and you're looking for some help.
User avatar
amplatfus
Samurai
Samurai
Posts: 153
Joined: 30 Oct 2012, 14:55
Distribution: MATE Porteus-v5.0rc1
Location: Romania

[solved ] Re: access a SAMBA network folder

Post#46 by amplatfus » 24 Jun 2013, 15:53

Hello,

I have good news :)
I have discovered that the problem have something to do with NTLM authentication.
I use until now the "security = share" but I saw in samba log file that "this is deprecated" so I changed to "security = user "in smb.conf in router.
I have defined jffs user with given rights.
Results: is working in all Porteus distribution, even in latest one (2.1 RC 1). Even curlftpfs is working.

Here, below are the commands I have used for user :

Code: Select all



#Because smbpasswd program build-in DD-WRT always
#treats /etc/samba/smbpasswd as the samba password file,
#and /etc is a readonly file system,
#we must temporary bind /tmp/etc to /etc when adding a user.
#Change # Add user for samba section like below:

# Add user for samba
cd
mount -o bind /tmp/etc /etc
cd /etc
vi passwd

# clear samba user if exists
#echo "" > /tmp/etc/samba/smbpasswd

#adduser
adduser jffsuser --home /mnt/jffs --shell /bin/false


#right permissions, let's change it (as root, of course): 
chown jffsuser:jffsuser /mnt/jffs

#At the end you should create the password for Samba access.
#It can (and #should) be different from the user system password.
#As this is the first #time we've assign the user a Samba password, you must use -a: 
#
#
#set password
smbpasswd -a jffsuser

umount /etc


Test it
Check if user is created in the system:
grep jffs /etc/passwd
smb://jffsuser@192.168.x.x/jffs/
smb://192.168.x.x/jffs/


#startup script +automount in ddwrt
grep -q jffsuser /etc/passwd || echo 'jffsuser::65534:65534:share:/mnt/jffsuser:/bin/false' >> /etc/passwd



#Porteus KDE 2.1 RC1
modprobe cifs
mkdir /mnt/pc
mount.cifs //192.168.x.x/mnt /mnt/pc -o username=jffs,password=*****

#curlftpfs
curlftpfs -o allow_other qwerty:pass@some.dyndns.org /ftpmount


#In the [global] section of Samba configuration, update the config value as indicated below:

[global]
    #Change this line as you see fit:
    server string = Samba Server
    interfaces = 192.168.x.x/24
	
    #Change this line as you see fit:
    workgroup = WORKGROUP
	
    #Change this line as you see fit:
    netbios name = DDWRT
	
	security = user
#security = SHARE --> DEPRECIATED
	encrypt passwords = Yes
#	passdb backend = smbpasswd
	smb passwd file = /tmp/etc/passwd
	null passwords = no
	guest account = nobody
	invalid users = root
#	time offset = -300
#	time offset = 60
#	lanman auth = No
	wins support = Yes
	socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
#	name resolve order = wins hosts lmhosts bcast 
	log file = /var/samba/sambalog.%m
	max log size = 100
	load printers = No
	dns proxy = No
	hosts allow = 192.168.x  
	remote announce = 192.168.x.255

#[homes]
#	comment = Home Directories
#	valid users = root
#	read only = No
#	browseable = No

[printers]
	comment = All Printers
	path = /opt/var/spool/samba
	printable = Yes
	browseable = No

[mnt]
	path = /mnt
	valid users = jffs
	read only = No
#	force user = root
	inherit permissions = Yes

[opt]
	path = /opt
	valid users = jffs
	read only = No
#	force user = root
	inherit permissions = Yes

I have edit rc.local for automount at boot.

Sources used:
http://www.dd-wrt.com/wiki/index.php/Co ... a_in_Linux
http://arouter.blogspot.ro/2011/07/samb ... d-wrt.html


Sursa ftpmount:
http://www.linuxnix.com/2011/03/mount-f ... linux.html

Others:
http://dd-wrt.com/wiki/index.php/Buffalo_WZR-HP-G300NH


Thank you for great support. I have learned a lot here.
Best regards,
amplatfus
Porteus-v5.0. rc1 MATE. Thank you all dev team and @Blaze for helping to configure it, thanks to entire Porteus community members for great topics.
Kernel: 000-kernel-5.4.8,xzm

User avatar
amplatfus
Samurai
Samurai
Posts: 153
Joined: 30 Oct 2012, 14:55
Distribution: MATE Porteus-v5.0rc1
Location: Romania

[solved ] access a SAMBA network folder

Post#47 by amplatfus » 30 Jun 2018, 12:00

I have a Porteus 4.0 instance up and running.
I tried the same command as before but is not working

Code: Select all

root@porteus:# modprobe cifs
root@porteus:# mount.cifs //192.168.0.1/pc /mnt/share -o username=user,password=password
Please let me know what I have to change.
The error is:

Code: Select all

mount error(22): Invalid argument
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
Thank you in advance,
amplatfus
Porteus-v5.0. rc1 MATE. Thank you all dev team and @Blaze for helping to configure it, thanks to entire Porteus community members for great topics.
Kernel: 000-kernel-5.4.8,xzm

User avatar
amplatfus
Samurai
Samurai
Posts: 153
Joined: 30 Oct 2012, 14:55
Distribution: MATE Porteus-v5.0rc1
Location: Romania

[solved ] access a SAMBA network folder

Post#48 by amplatfus » 30 Jun 2018, 12:39

I found the fix reading /mnt/live/memory/changes/var/log/syslog.

Code: Select all

Jun 30 14:37:43 porteus kernel: [  670.154340] No dialect specified on mount. Default has changed to a more secure dialect, SMB2.1 or later (e.g. SMB3), from CIFS (SMB1). To use the less secure SMB1 dialect to access old servers which do not support SMB3 (or SMB2.1) specify vers=1.0 on mount.

The working command:

Code: Select all

mount -t cifs -o  username=user,password=password,vers=1.0 //192.168.0.1/share/ /mnt/share
Source of command:
https://askubuntu.com/questions/967144/ ... mount-cifs

All the best,
amplatfus
Porteus-v5.0. rc1 MATE. Thank you all dev team and @Blaze for helping to configure it, thanks to entire Porteus community members for great topics.
Kernel: 000-kernel-5.4.8,xzm

Post Reply