Create a new Samba user profile
Just a quick one tonight - how to quickly add a new user profile in (Ubuntu) linux and export their home profile directory as a Samba share. (You need to add them twice, once for linux and once for Samba.)
# useradd -d /home/foo -m foo
# passwd foo
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
# smbpasswd -a foo
New SMB password:
Retype new SMB password:
Added user foo.
a couple of things to note - you could use 'adduser' instead of useradd, but that will prompt you for the users info, which you may find you prefer (if in a non-scripted evironment)
also 'smbpasswd foo' might be required if, after running the command to add a new Samba user, it creates that user with a locked account - this should allow you to set the password and unlock them.
now connect to \\servername\username
Quick troubleshooting steps:
check all spellings in the /etc/samba/smb.conf
check spellings on windows client
read the comments in the smb.conf file! (especially the testparm hint!!)
Of course, I'm assuming you already know how to sudo apt-get install samba, configure your '[homes] directory exports in the smb.conf file, and restart samba '/etc/init.d/samba restart'. If not I got all I needed from:
google books (Hacking Ubuntu
By Neal Krawetz)
# useradd -d /home/foo -m foo
# passwd foo
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
# smbpasswd -a foo
New SMB password:
Retype new SMB password:
Added user foo.
a couple of things to note - you could use 'adduser' instead of useradd, but that will prompt you for the users info, which you may find you prefer (if in a non-scripted evironment)
also 'smbpasswd foo' might be required if, after running the command to add a new Samba user, it creates that user with a locked account - this should allow you to set the password and unlock them.
now connect to \\servername\username
Quick troubleshooting steps:
check all spellings in the /etc/samba/smb.conf
check spellings on windows client
read the comments in the smb.conf file! (especially the testparm hint!!)
Of course, I'm assuming you already know how to sudo apt-get install samba, configure your '[homes] directory exports in the smb.conf file, and restart samba '/etc/init.d/samba restart'. If not I got all I needed from:
google books (Hacking Ubuntu
By Neal Krawetz)
Labels: adduser, export, home directory, profile, samba, share, smbpasswd, ubuntu, useradd


