Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for the Domain username #6

Closed
RiccardoSaettone opened this issue Feb 17, 2017 · 9 comments
Closed

Support for the Domain username #6

RiccardoSaettone opened this issue Feb 17, 2017 · 9 comments

Comments

@RiccardoSaettone
Copy link

RiccardoSaettone commented Feb 17, 2017

My NAS is in a Domain so my username when I mount a share is something like domain\username.
but when i configure my .plist with something like

<key>Account</key> <string>mydomain\myusername</string>

I have this error

bash-3.2$ /usr/local/bin/automount.sh -m /Users/********/Library/Preferences/it.niemetz.automount.plist or /Users/********/Library/Keychains/login.keychain are missing bash-3.2$ chown ${USER}:staff /usr/local/bin/automount.sh

I think that special characters like \ and @ aren't support for login name, is something similar of the "bug" of sadrian80 with the special characters in the password,

@RiccardoSaettone
Copy link
Author

RiccardoSaettone commented Feb 17, 2017

I think that this can help you:

I found that if i try to mount the NAS in terminal in must change the \ between Domain and username with a ;
practically
mount_smbfs -o soft,nodev,nosuid 'smb://myDomain\ myUsername@myNAS/TEST' /Users/*******/Volumes/TEST
DOESN'T WORK

But if i change myDomain\myUsername with myDomain;myUsername
mount_smbfs -o soft,nodev,nosuid 'smb://myDomain;myUsername@myNAS/TEST /Users/*******/Volumes/TEST
everything works correctly

So i change my .plist Account string from:
myDomain\myUsername
to
myDomain;myUsername

and add a new keychain entry

/usr/local/bin/automount.sh --addpassword --account='myDomain;myUsername' --server=myNAS --protocol=smb

The ' ' in the --account are mandatory otherwise the character ; will not be accepted

Now all works.

@gniemetz
Copy link
Owner

I'll take a look and post back

Thank you

@RiccardoSaettone
Copy link
Author

I test the last version 0.90.18, but doesn't work
the password is taken correctly from the keychain, and also the domain an the username from del .plst file, but when the script end I have this error in the log

sudo /usr/local/bin/automount.sh -m
mount of MYSHARE failed (RC=1, RV=)
automount runned with errors.
and the volume is not mounted

This is a extract of the debug, I hope this can help

+++(/usr/local/bin/automount.sh:416): getPasswordFromKeychain(): security find-internet-password -w -r 'smb ' -a MYUSER -l MYNAS -j automount /Users/MACUSER/Library/Keychains/login.keychain-db +++(/usr/local/bin/automount.sh:425): getPasswordFromKeychain(): _RC=0 +++(/usr/local/bin/automount.sh:427): getPasswordFromKeychain(): '[' 0 -ne 0 ']' +++(/usr/local/bin/automount.sh:430): getPasswordFromKeychain(): return 0 ++(/usr/local/bin/automount.sh:710): processMountlist(): launchctl asuser 501 chroot -u 501 -g 20 / expect -c ' set timeout 30 log_user 1 spawn /sbin/mount_smbfs -o soft,nodev,nosuid //MYNAS/MYSHARE /Users/MACUSER/Volumes/MYSHARE expect { "ser:" { if {"MYNAS" == ""} { send -- “MYNASUSER\r” } else { send -- “MYDOMAIN;MYNASUSER\r" } exp_continue } "sword:" { send -- “MYPASSWORD\r” exp_continue } timeout { exit 1 } eof { return } } catch wait result exit [lindex $result 3]' +(/usr/local/bin/automount.sh:710): processMountlist(): _RV='spawn /sbin/mount_smbfs -o soft,nodev,nosuid //MYNAS/MYSHARE /Users/MACUSER/Volumes/MYSHARE Password for MYNAS: ' +(/usr/local/bin/automount.sh:711): processMountlist(): _RC=1 +(/usr/local/bin/automount.sh:740): processMountlist(): '[' 1 -eq 0 ']' +(/usr/local/bin/automount.sh:744): processMountlist(): log --priority=3 'mount of MYSHARE failed (RC=1, RV=spawn /sbin/mount_smbfs -o soft,nodev,nosuid //MYNAS/MYSHARE /Users/MACUSER/Volumes/MYSHARE Password for MYNAS: )'

@gniemetz
Copy link
Owner

It looks like you don't get asked about the user, only the password. Try to mount the filesystem manually as stated in the log: /sbin/mount_smbfs -o soft,nodev,nosuid //MYNAS/MYSHARE /Users/MACUSER/Volumes/MYSHARE and look at the response you get from the command. It should ask for a user (expect "ser:") and for the password (expect "sword:")

@RiccardoSaettone
Copy link
Author

I tried, and you're right, it asks me only the password:

/sbin/mount_smbfs -o soft,nodev,nosuid //MYNAS/MYSHARE /Users/MACUSER/Volumes/MYSHARE

Password for MyNAS:

"Password for MyNAS:" is exactly what is written on the terminal when it asks me for the password

after entering the password the shared folder is mounted correctly

gniemetz added a commit that referenced this issue Feb 28, 2017
v 0.9.19 in dev-branch hopefully fixes the mount_smbfs error
@gniemetz
Copy link
Owner

Would you please try v0.90.19 from dev-branch if this error is fixed?

@RiccardoSaettone
Copy link
Author

RiccardoSaettone commented Feb 28, 2017

I tried, but don't work.
When the script end I don't have error:

MYSHARE mounted successfully All shares mountd successfully.

But the shared folder are not mount.

This is a part of the debug log:
I think that the there aren't ' ' at the start ed at the end of MYDOMAIN;MYNASUSER'

					set timeout 30
					log_user 1
					spawn /sbin/mount_smbfs -o soft,nodev,nosuid //MYDOMAIN;MYNASUSER@MYNAS/MYSHARE /Users/MYMACUSER/Volumes/MYSHARE
					expect {
						-re "..*ser.*|.*name.*" {
							if {"MYNAS" == ""} {
								send -- "MYNASUSER\r"
							} else {
								send -- "MYDOMAIN;MYNASUSER\r"
							}
							exp_continue
						}
						-re ".*ssword.*" {
							send -- “*****************r”
							IN the place of the * There are something like \x00\x25\x54 the password converted in ex code i think
							exp_continue
						}
						timeout {
							exit 1
						}
						eof {
							return
						}
					}
					catch wait result
					exit [lindex $result 3]'
+(/usr/local/bin/automount.sh:710): processMountlist(): _RV='spawn /sbin/mount_smbfs -o soft,nodev,nosuid //MYDOMAIN
invalid command name "MYNASUSER@MYNAS/MYSHARE"
    while executing
'MYNASUSER@MYNAS/MYSHARE /Users/MYMACUSER/Volumes/MYSHARE"

gniemetz added a commit that referenced this issue Feb 28, 2017
@RiccardoSaettone
Copy link
Author

YES now it works
Thanks

@gniemetz
Copy link
Owner

You're welcome :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants