Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Automount passwordless NT Shares as Administrator via /etc/nsmb.conf

Posted on 2006-06-15
17
Medium Priority
?
903 Views
Last Modified: 2013-11-22
Hello,
I'm creating a bash script to automount remote NT Partitions via samba. I have configured my /etc/nsmb.conf so that the passwords are automatically looked up. A snippet of my /etc/nsmb.conf looks like this:

[default]
workgroup=NAMEOFWORKGROUP
[NTSERVER1]
workgroup=NTSERVERWORKGROUP
addr=xxx.xxx.xxx.xxx
[NTSERVER1:ADMINISTRATOR]
password=administratorpassword

The command I use in the bash script to mount the Shares is:
mount_smbfs //ADMINISTRATOR@NTSERVER1/Share$ /root/mnt/NTSERVER1

All the above work as a charm when the password for the ADMINISTRATOR at the remote NTSERVER is not null. However, we have a box that has a passwordless Administrator account. We call this Dummy ;) When I try to mount Dummy's Share using the bash script I mentioned earlier, it refuses to mount it unless I press the CR as it prompts for password. I'm mounting the share as normal with:

  mount_smbfs //ADMINISTRATOR@DUMMY/Share$ /root/mnt/Dummy
Output:
  Password: [here I press the CR and it mounts it just fine]

I tried adding the following to my /etc/nsmb.conf but with no luck:
[DUMMY]
workgroup=DUMMYWORKGROUP
addr=xxx.xxx.xxx.xxx
[DUMMY:ADMINISTRATOR]
password=

As you noticed, I tried to leave the password field blank but the script again prompted me for password.

What I want to do is somehow pass a Newline to the mount_smbfs //ADMINISTRATOR@DUMMY/Share$ /root/mnt/Dummy command in the script so that I don't get prompted for a password or tell nsmb.conf that the password for Administrator@Dummy is blank.

Thx in advance for any help.
0
Comment
Question by:Phreonx
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 5
  • 2
  • +1
17 Comments
 
LVL 1

Expert Comment

by:Funcod
ID: 16918110
try this :
"password=*"
is it working?
0
 
LVL 4

Author Comment

by:Phreonx
ID: 16918296
Sorry Funcod but no.
As an alternative, I tried creating an empty file which I call Newline and contains a newline only [I created a file pressed CR and saved it]. Then I appended that file to the mount_smbfs //ADMINISTRATOR@DUMMY/Share$ /root/mnt/Dummy as follows:

mount_smbfs //ADMINISTRATOR@DUMMY/Share$ /root/mnt/Dummy << `cat /folder/subfolder/NEWLINE | head -n1`
but still no good.
0
 
LVL 1

Expert Comment

by:Funcod
ID: 16918332
try alt+0160 or alt+255
its the code for space
if that doesnt work try
password=""
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 4

Author Comment

by:Phreonx
ID: 16918451
Still no good. Still asks for password. Apart from trying what you suggested, I also tried ALT+015 in ee, it prompted me to insert ascii code, I entered 013 [CR] but nothing.
0
 
LVL 1

Expert Comment

by:Funcod
ID: 16918630
u need to use CR+LF (carriage return + line feed)
password=alt+013(+)alt+010
it should work

0
 
LVL 4

Author Comment

by:Phreonx
ID: 16918757
I tried that but with alt+013 the cursor jumps to a newline and then when I press alt+010, ^@ appears. I run the script but still prompts for password.
0
 
LVL 4

Author Comment

by:Phreonx
ID: 16918883
I know it's very frustruting. A seemingly straightforward procedure taking so long to figure out how to do it. Thx for your time Funcod.
0
 
LVL 1

Expert Comment

by:Funcod
ID: 16920631
1) it must be done using the number pad
2) your script
-type it using your nt notepad (remember to rename it to the right extension)
-move it to the right folder
-in your script u can try :
 a) alt+010 only
 b) alt+010"+"alt+013
 c) alt+013
you shouldn't get the ^@
it should work unless you havent done the script right
and password=* or password="*" should have worked with nt btw.
good luck
0
 
LVL 4

Author Comment

by:Phreonx
ID: 16920906
I'll try what you recommended when I get home. Im too tired to troubleshoot anything right now. Thx again
0
 
LVL 4

Author Comment

by:Phreonx
ID: 16932286
I spent the entire weekend trying to figure out what's wrong with the nsmb.conf and it doesn't accept blank passwords. Unfortunately, I could not find a solution. So Funcod, if you agree I would like to close this question, setup a bloody password at the Dummy box and get this thing over with because I can't spent much more time on this matter.
0
 
LVL 1

Expert Comment

by:Funcod
ID: 16933502
np
0
 
LVL 4

Author Comment

by:Phreonx
ID: 16933510
Thx for all your help. Closing now
0
 
LVL 62

Expert Comment

by:gheist
ID: 16968336
it does not run nsmb.conf for password for obvious reasons. password is read from ~/.nsmbrc if ever.
0
 
LVL 4

Author Comment

by:Phreonx
ID: 16969166
Thanks for the tip gheist but as I mentioned at an earlier post, I've already setup a password for Dummy because at that time, I could not afford to look for an answer to my problem any more. I really appreciate you answering and I will try to implement your solution if a similar situation arises.
0
 

Accepted Solution

by:
RomMod earned 0 total points
ID: 16970726
Question closed - 75 points refunded.

Best regards,
RomMod
Experts Exchange
Community Support Moderator
0
 
LVL 62

Expert Comment

by:gheist
ID: 16976867
I did not pretend to offer solution. Just noticed smth forgotten...
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A metadevice consists of one or more devices (slices). It can be expanded by adding slices. Then, it can be grown to fill a larger space while the file system is in use. However, not all UNIX file systems (UFS) can be expanded this way. The conca…
FreeBSD on EC2 FreeBSD (https://www.freebsd.org) is a robust Unix-like operating system that has been around for many years. FreeBSD is available on Amazon EC2 through Amazon Machine Images (AMIs) provided by FreeBSD developer and security office…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question