LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 04-05-2011, 11:09 AM   #1
ramecare
Member
 
Registered: Feb 2011
Posts: 179

Rep: Reputation: 0
Smile useradd & smbpasswd using shell script


Hello,

Can any one help me how to useradd & smbpasswd using shell script.The below script i tried but its not working.

echo "$ecare2@" | smbpasswd -as "$ramecare"

Can any one help me on this.

Thank u in advance
 
Old 04-05-2011, 03:47 PM   #2
Snark1994
Senior Member
 
Registered: Sep 2010
Distribution: Debian
Posts: 1,632
Blog Entries: 3

Rep: Reputation: 346Reputation: 346Reputation: 346Reputation: 346
You didn't mention any commands using useradd, so I assume you've got that working. What you've got looks about right (perhaps separate the -a and the -s options, and put $ramecare after the '-a'?)... Maybe running your script with "bash -x <script>" would shed some light. Certainly, I think you should be more careful with your variables (writing them as "${ramecare}" would be better practice)

Hope this helps,
 
Old 04-06-2011, 01:08 AM   #3
ramecare
Member
 
Registered: Feb 2011
Posts: 179

Original Poster
Rep: Reputation: 0
Hi!

When i use this command echo "$ecare2@" | smbpasswd -s -a "${ramecare}" iam getting the error

Mismatch - password unchanged.
Unable to get new password.
 
Old 04-06-2011, 01:34 AM   #4
xiaodown
Member
 
Registered: Jun 2003
Location: Virginia
Distribution: Redhat, Centos, Fedora
Posts: 37

Rep: Reputation: 15
Does the user that you're trying to create already exist as a local system user?

Are you running smbpasswd as root (or with sudo)?

Have you tried smbpasswd with the -D 1 or -D 2 flag (debug, logs extra info)?

For that matter, is there anything interesting in /var/log/samba/smbd.log (or other logs)?

Is "localhost" one of the allowed hosts in smb.conf? Is smbd on?

Did you try some version of
Code:
smbpasswd -as $username < $password
 
Old 04-06-2011, 02:02 AM   #5
ramecare
Member
 
Registered: Feb 2011
Posts: 179

Original Poster
Rep: Reputation: 0
Yes aready the user is in local system,for the created local user only iam addding samba user,not sudo,i tried the above mentioned command it's not working showing the below error "./steps: line 2: @: No such file or directory"
 
Old 04-06-2011, 02:57 AM   #6
ramecare
Member
 
Registered: Feb 2011
Posts: 179

Original Poster
Rep: Reputation: 0
Can anyone give suggesion for the above issue.

Thanks in advance.

Last edited by ramecare; 04-06-2011 at 05:18 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Useradd Shell Script nova_9* Linux - Newbie 10 02-19-2010 05:02 PM
[SOLVED] A bit confused with && and || operators in shell script luvshines Programming 6 11-24-2009 01:37 PM
C & kernel data structure & shell script vishalbutte Programming 7 01-13-2006 09:38 AM
shell script + change shell && continue darkRoom Programming 6 02-25-2005 03:50 AM
adduser and smbpasswd script homey Linux - Networking 7 09-16-2004 07:01 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 07:33 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration