Page 1 of 3 123 LastLast
Results 1 to 10 of 25

Thread: Samba Setup Error: Failed to add entry for user

  1. #1
    Join Date
    Jan 2008
    Location
    Canada
    Beans
    430
    Distro
    Kubuntu 14.10 Utopic Unicorn

    Exclamation Samba Setup Error: Failed to add entry for user

    I am trying to set up my Ubuntu 10.04 netbook to see my WinXP desktop's files and vice a versa.

    I followed the steps in this tutorial thread: HOWTO: Setup Samba peer-to-peer with Windows

    I got as far as "Time to add yourself as an samba user." at this point I keep getting the following error:

    Code:
    sudo smbpasswd -L -a WinXP_User_Name
    New SMB password:
    Retype new SMB password:
    Failed to add entry for user WinXP_User_Name.
    My WinXP machine has no password.

    My conf file is here:

    [global]
    ; General server settings
    ;
    netbios name = WinXP_Computer_Name
    server string =
    ;
    workgroup = WinXP_WorkStation_Name
    announce version = 5.0
    socket options = TCP_NODELAY IPTOS_LOWDELAY SO_KEEPALIVE SO_RCVBUF=8192 SO_SNDBUF=8192

    passdb backend = tdbsam
    security = user
    null passwords = true
    username map = /etc/samba/smbusers
    name resolve order = hosts wins bcast
    ;
    wins support = no

    printing = CUPS
    printcap name = CUPS

    syslog = 1
    syslog only = yes

    ; NOTE: If you need access to the user home directories uncomment the
    ; lines below and adjust the settings to your hearts content.
    ;[homes]
    ;valid users = %S
    ;create mode = 0600
    ;directory mode = 0755
    ;browseable = no
    ;read only = no
    ;veto files = /*.{*}/.*/mail/bin/

    ; NOTE: Only needed if you run samba as a primary domain controller.
    ; Not needed as this config doesn't cover that matter.
    ;[netlogon]
    ;path = /var/lib/samba/netlogon
    ;admin users = Administrator
    ;valid users = %U
    ;read only = no

    ; NOTE: Again - only needed if you're running a primary domain controller.
    ;[Profiles]
    ;path = /var/lib/samba/profiles
    ;valid users = %U
    ;create mode = 0600
    ;directory mode = 0700
    ;writeable = yes
    ;browseable = no

    ; NOTE: Inside this place you may build a printer driver repository for
    ; Windows - I'll cover this topic in another HOWTO.
    [print$]
    path = /var/lib/samba/printers
    browseable = yes
    guest ok = yes
    read only = yes
    write list = root
    create mask = 0664
    directory mask = 0775

    [printers]
    path = /tmp
    printable = yes
    guest ok = yes
    browseable = no

    ; Uncomment if you need to share your CD-/DVD-ROM Drive
    ;[DVD-ROM Drive]
    ;path = /media/cdrom
    ;browseable = yes
    ;read only = yes
    ;guest ok = yes

    ;
    [MyFiles]
    ;
    path = /media/samba/
    browseable = yes
    read only = no
    guest ok = no
    create mask = 0644
    directory mask = 0755
    ;
    force user = WinXP_User_Name
    ;
    force group = WinXP_User_Name
    Can anyone tell me what I am doing wrong?

    Thanks

  2. #2
    Join Date
    Feb 2007
    Location
    Leicester, England
    Beans
    160
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Samba Setup Error: Failed to add entry for user

    Here is how I do it. May not be the best or even correct but works for me.

    I have found that the username and password must be exactly the same for your linux user, samba user and XP user or your in trouble. Put the same username and password on your XP box

    TO ADD USER

    sudo adduser --shell /bin/false 'name'
    (no shell with this)
    sudo adduser --shell /bin/bash 'name'
    (shell with this)

    sudo passwd 'name' 'new password'

    sudo smbpasswd -a 'name'

    Here is part of my /etc/samba/smb.conf

    [alan]
    path = /home/alan
    force group = alan
    read only = No
    create mask = 0770
    force create mode = 0770
    directory mask = 0770
    force directory mode = 0770

    To make the files available to other users you have to add them to the group "alan". I just edit /etc/group and add the users to the relevant line as

    alan:x:1000:john,tom

    Then

    sudo service smbd restart

    Should be good to go. Please note the bold text!

    Here are some other examples

    [jill]
    path = /home/jill
    force group = jill
    write list = +jill
    read only = Yes
    create mask = 0770
    directory mask = 0770
    guest ok = Yes

    [jack]
    path = /home/jack
    valid users = +jack
    force group = jack
    read only = No
    create mask = 0770
    force create mode = 0770
    directory mask = 0770
    force directory mode = 0770


    Yes there are many ways of doing it the more ways the easier it is to get wrong. Please note I am no expert so hope this works for you good luck.
    Last edited by alan34; June 20th, 2010 at 07:24 PM.

  3. #3
    Join Date
    Jan 2008
    Location
    Canada
    Beans
    430
    Distro
    Kubuntu 14.10 Utopic Unicorn

    Re: Samba Setup Error: Failed to add entry for user

    Thanks for the reply Alan but I can't have my user names and passwords all the same.

    The instructions seem so simple. I can't understand what is wrong.

  4. #4
    Join Date
    Jan 2008
    Location
    Canada
    Beans
    430
    Distro
    Kubuntu 14.10 Utopic Unicorn

    Re: Samba Setup Error: Failed to add entry for user

    ^

  5. #5
    Join Date
    Feb 2007
    Location
    Leicester, England
    Beans
    160
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Samba Setup Error: Failed to add entry for user

    I believe your original error is because you have not added xp_user to your linux machine as a regular user
    eg
    sudo adduser --shell /bin/false xp_user

    sudo passwd xp_user

    sudo smbpasswd -a xp_user ## same password!!

    sudo mkdir /home/samba

    sudo mkdir /home/samba/xp_user

    sudo chmod -R 777 /home/samba

    sudo chown xp_user.xp_user /home/samba/xp_user


    in /etc/samba/smb.conf

    [xp_user]
    path = /home/samba/xp_user
    force group = xp_user
    read only = no
    create mask = 0777
    force create mode = 0777
    directory mask = 0777
    force directory mode = 0777
    guest ok = yes

    (Note this is as leaky as sieve so fine tune permissions once you get it to work. The above to 0770.)


    sudo vi /etc/group $$ or whatever text editor you like

    xp_user:x:1001:john,tom,alan etc,etc


    sudo service smbd restart


    Go to your windows box and add a user xp_user with the same password and try. You can always create a test user just to try to get it working first then
    experiment until you get the configuration you want.

    Make a note of the IP address of your linux machine

    ifconfig -a

    say 192.168.0.10


    Then on your windows machine Tools-Map Network Drive

    \\192.168.0.10\xp_user

    Can't be certain this is correct but should work - only use linux at home, linux/windows at work.

    Keep trying you will get there. Make notes and backups before you edit files so you can go back.

    Good luck.
    Last edited by alan34; June 22nd, 2010 at 12:09 PM.

  6. #6
    Join Date
    Dec 2009
    Beans
    6,116

    Re: Samba Setup Error: Failed to add entry for user

    You've got three problems:

    (1) Creating a samba user is a two step process. For example, if I want to give a remote user "mary" access to a share:

    Open Terminal and type
    Code:
    sudo useradd -s /bin/true mary
    This will create a "mary" user that has no local logon capability and no home directory.
    Code:
    sudo smbpasswd -a mary
    This will add AND enable a "mary" samba account/password.

    And they do not have to match mary's WIndows login username and password. Why would mary want to provide the server with her local login user name and password?

    (2) Anyway you likely will have another problem and it has nothing to do with Samba:

    If you created the folder /media/samba this way:
    Code:
    sudo mkdir /media/samba
    It had ownership = root and mode = 755 meaning root can read and write and everyone else could only read. You created a writeable share so this isn't going to work. Yo will need to modify the permisions on the shared folder. One way to do that is like this:
    Code:
    sudo chmod 0777 /media/samba
    (3) Ownerhip and permissions of mary's files on your share:
    [MyFiles]
    ;
    path = /media/samba/
    browseable = yes
    read only = no
    guest ok = no
    create mask = 0644
    directory mask = 0755
    ;
    force user = WinXP_User_Name
    ;
    force group = WinXP_User_Name
    When WinXP_User_Name saves a file it will be owned by her and you as the share owner will only be able to read the file and not write to it. Perhaps that's what you want it to do so you can keep track of what's the remote users files and what's yours. But if you want to write to those files you will have to change the force user to you ( the share owner ) not the remote user. Then all files will be writeable to both you and the remote user.

  7. #7
    Join Date
    Jan 2008
    Location
    Canada
    Beans
    430
    Distro
    Kubuntu 14.10 Utopic Unicorn

    Unhappy Re: Samba Setup Error: Failed to add entry for user

    Windows cannot find my share folder in Ubuntu.

    These are all the steps I have followed to make things clear:

    1 Install Samba:
    Code:
    sudo apt-get install samba
    2 Stop Samba:
    Code:
    sudo /etc/init.d/samba stop
    3 Back up /etc/samba/smb.conf
    4 Paste contents of conf supplied in thread (as in 1st post in this thread)
    5 Make the following edits:
    [global]
    netbios name = WinXP_Computer_Name
    workgroup = WinXP_WorkStation_Name
    wins support = no
    [MyFiles]
    path = /media/samba/
    force user = WinXP_User_Name
    force group = WinXP_User_Name
    6 Make share directory
    7 Set permissions:
    Code:
    sudo chmod 0777 /media/samba
    8 Start Samba:
    Code:
    sudo /etc/init.d/samba start
    failed
    found this command in forums; it worked:
    Code:
    sudo service smbd start
    9 Add Samba user to Ubuntu (as per Morbius1)
    Code:
    sudo useradd -s /bin/true WinXP_User_Name
    10 Add Samba user to Samba
    Code:
    sudo smbpasswd -L -a WinXP_User_Name
    sudo smbpasswd -L -e WinXP_User_Name
    All good on the Ubuntu side (thank you Morbius1), now on to Windows XP

    The instructions say you must have static IPs to use WINS in Windows. Since I don't have that I set WINS to no in the conf and followed the WINS disabled section:

    Map Network Drive:
    With WINS disabled:
    - Click "START"
    - Right-click "My Computer"
    - Select "Map network drive"
    - Choose the drive letter
    - Type \\<ip-address>\MyFiles
    NOTE: To find out the ip-address of your Linux box type "ifconfig" inside a terminal and find the ip for the correct interface (i.e. eth0). Don't forget to adjust the sharename to the name you chose above.
    - Click "Finish"

    That's it - samba is up and running now.
    For the IP I used "inet addr" from ifconfig.
    I tried both:
    Code:
    //192.168.123.123/MyFiles
    //192.168.123.123/media/samba
    But Windows cannot find it: "the network path <path I entered> cannot be found" and this message comes up very quickly.

    What am I missing that prevents WinXP from mapping this network drive?

    thanks

  8. #8
    Join Date
    Dec 2009
    Beans
    6,116

    Re: Samba Setup Error: Failed to add entry for user

    [global]
    netbios name = WinXP_Computer_Name
    workgroup = WinXP_WorkStation_Name
    wins support = no
    [MyFiles]
    path = /media/samba/
    force user = WinXP_User_Name
    force group = WinXP_User_Name
    To be honest with you, since you're trying to map the linux share by ip address I don't know if that is going to be a problem or not but your "netbios name" is not correct. The netbios name is the name of the Ubuntu box not the Windows box. You need to fix that. Windows will short circuit if it sees itself on the network

    As for the workgroup = , I assume you set it to WORKGROUP or whatever the workgroup name is on the Windows box.

    I tried both:
    Code:
    //192.168.123.123/MyFiles
    //192.168.123.123/media/samba
    The second one will never work because it's not a share and I don't know if that's a typo but your slashes are going in the wrong direction in windows. It should be:
    Code:
    \\192.168.123.123\MyFiles
    If you don't have static ip address your map may not survive a reboot though. Maybe when you fix the netbios name you'll be able to browse to the share and use the ubuntu machine name from Windows.

    EDIT: I just read through your original post again. You had that netbios name and workgroup parameter wrong from the beginning. Sorry I missed that
    Last edited by Morbius1; June 23rd, 2010 at 09:40 PM.

  9. #9
    Join Date
    Jan 2008
    Location
    Canada
    Beans
    430
    Distro
    Kubuntu 14.10 Utopic Unicorn

    Re: Samba Setup Error: Failed to add entry for user

    I corrected netbios to my Ubuntu machine name (via hostname in terminal)
    Yes, workgroup is the WinXP's workgroup name.
    Yes, the slashes were a typo so I'm using
    Code:
    \\192.168.123.123\MyFiles
    I restarted samba with
    Code:
    sudo service smbd restart
    after editing the conf.

    No change in result though.

    If you don't have static ip address your map may not survive a reboot though. Maybe when you fix the netbios name you'll be able to browse to the share and use the ubuntu machine name from Windows.
    Reboot of Ubuntu?

    It seems to be the same upon reboots. Am I using the wrong IP?

  10. #10
    Join Date
    Dec 2009
    Beans
    6,116

    Re: Samba Setup Error: Failed to add entry for user

    I corrected netbios to my Ubuntu machine name (via hostname in terminal)
    In smb.conf:
    Change this:
    netbios name = WinXP_Computer_Name
    To this:
    Code:
    netbios name = ubuntubox
    And restart samba.

    The netbios name = parameter in smb.conf will override anything you do with hostname.

Page 1 of 3 123 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •