LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 09-14-2006, 07:42 PM   #1
depam
Member
 
Registered: Sep 2005
Posts: 829

Rep: Reputation: 30
adduser with smbpasswd


Hi,

Does anyone know of a quick script that could
be run to add a linux account and samba account
at the same time?

For example, something like this:

# smbadduser joeuser
type in password:
re-type password:

and boom, linux account is in, and smbpasswd in too.

Thanks
 
Old 09-15-2006, 07:01 AM   #2
sparton
Member
 
Registered: Nov 2003
Location: Cincinnati, Ohio
Distribution: Ubuntu 6.06 /SLED10
Posts: 45

Rep: Reputation: 15
If everything is installed correctly.


Quote:
smbpasswd -a joe
Quote:
Enter Desired Password And Confirm
Quote:
smbpasswd -e joe
Quote:
Enables user joe
 
Old 09-15-2006, 08:09 AM   #3
chrwei
LQ Newbie
 
Registered: Jan 2005
Posts: 24

Rep: Reputation: 15
you can make a wrapper for both using an "expect passwd" script, or..

let samba do it. look up the "add user script" directive (as well as del user and modify user) for smb.conf, then use the "net user" set of commands (from linux or windows) to add users to the system.

or, use webmin/usermin to mange users, it has optional samba/unix integrated account management built in.
 
Old 09-18-2006, 02:50 AM   #4
Sukhwinder Singh
LQ Newbie
 
Registered: Sep 2006
Posts: 4

Rep: Reputation: 0
smbpasswd

i have a solution for it
type the following script

#vi smbadduser
where smbadduser in not command but it is file name
then wirte some commands in smbadduser file like

echo Type the name of user
read username
useradd $username
passwd $username
echo Type samba user password
smbpasswd -a $username
............
and save it
.........................................

then change the mode of smbadduser file like
#chmod 755 smbadduser
then copy the file into /bin directory

then run the smbadduser command at the command prompt

your output is
[root@biskik2 /]# smbadduser
Type the name of user
sukh
Changing password for user sukh.
New UNIX password:
BAD PASSWORD: it is WAY too short
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
Type samba user password
New SMB password:
Retype new SMB password:
Added user sukh.
[root@biskik2 /]#

Last edited by Sukhwinder Singh; 09-22-2006 at 05:18 AM.
 
Old 09-18-2006, 08:20 AM   #5
chrwei
LQ Newbie
 
Registered: Jan 2005
Posts: 24

Rep: Reputation: 15
Quote:
Originally Posted by Sukhwinder Singh
i have a solution for it
type the following at command line
#smbpass -a username
what part of "add linux account AND samba account" was unclear to you in the first post? also smbpasswd -a was already suggested.

I don't mean to dicourage you from trying to help people, but PLEASE read and understand the question, as well as the previous answers, before responding. anythign else is just noise and polution.
 
Old 09-01-2012, 08:52 AM   #6
maxpfc
LQ Newbie
 
Registered: Aug 2012
Posts: 1

Rep: Reputation: Disabled
Tone

Quote:
Originally Posted by chrwei View Post
what part of "add linux account AND samba account" was unclear to you in the first post? also smbpasswd -a was already suggested.

I don't mean to dicourage you from trying to help people, but PLEASE read and understand the question, as well as the previous answers, before responding. anythign else is just noise and polution.

Thing is when you use tone like that, people who do know the answer think,"Why should I bother" Maybe the guy did not have the mental capacity or knowledge to answer correct but he it trying. As are you. Simple questions like your's, someone like me could also consider "noise and pollution" since the solution is well documented. Just have a bash script that passes all available parameters to useradd and smbpasswd in that order and no user interaction is necessary.The only tricky bit is when you pass the -p parameter to useradd it should be in encrypted format (by the crypt function ) read up on the parameters for useradd and smbpasswd. A good way to get the encrypted password is to add a fake user first, with the desired password, copy the password out of /etc/shadow then delete the fake user. Good luck to you. I realize this is an old post, but I'm answering for the benefit of others still looking for a solution.
 
  


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
adding users using smbpasswd, or synchronise passwd/smbpasswd gyodai Linux - Networking 2 03-11-2009 02:47 PM
smbpasswd leiw Linux - General 3 07-25-2006 05:55 PM
adduser and smbpasswd script homey Linux - Networking 7 09-16-2004 06:01 PM
smbpasswd -a ... smbpasswd: Command not found Lleb_KCir Linux - Software 7 08-11-2004 11:27 AM
smbpasswd whaase Linux - Networking 3 11-02-2003 03:48 PM


All times are GMT -5. The time now is 02:05 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration