SSH User with Jailkit: wrong entry in passwd

Discussion in 'Installation/Configuration' started by wwweiss, Mar 6, 2013.

  1. wwweiss

    wwweiss New Member HowtoForge Supporter

    Hi,

    my System is Ubuntu 12.04.2 LTS with ISPConfig 3.0.5.1

    When adding shell users with jailkit the passwd file has a wrong entry. It Looks like this:

    tester_s1:x:5005:5006:::/bin/bash

    If I Change this manually to

    tester_s1:x:5005:5006::/home/tester_s1:/bin/bash

    everything works without any problems.
    Is this a bug or do I have any missconfiguration? If so, how can I change it?
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

  3. wwweiss

    wwweiss New Member HowtoForge Supporter

    I set the loglevel to debug and added one more SSH-User. This is the what I get in the system log:

    2013-03-06 15:06 h1.wwweiss.de Debug Processed datalog_id 100
    2013-03-06 15:06 h1.wwweiss.de Debug Jailkit Plugin -> insert username:autobendert1
    2013-03-06 15:06 h1.wwweiss.de Debug ssh-rsa key updated in /var/www/clients/client5/web5//home/autobendert1/.ssh/authorized_keys
    2013-03-06 15:06 h1.wwweiss.de Debug ssh-rsa authorisation keyfile created in /var/www/clients/client5/web5//home/autobendert1/.ssh/authorized_keys
    2013-03-06 15:06 h1.wwweiss.de Debug ssh-rsa setup shelluser_jailkit
    2013-03-06 15:06 h1.wwweiss.de Debug Added jailkit parent user home in : /var/www/clients/client5/web5/home/web5
    2013-03-06 15:06 h1.wwweiss.de Debug Added created jailkit user home in : /var/www/clients/client5/web5/home/autobendert1
    2013-03-06 15:06 h1.wwweiss.de Debug Added jailkit user to chroot with command: /usr/local/ispconfig/server/scripts/create_jailkit_user.sh autobendert1 /var/www/clients/client5/web5 /home/autobendert1 /bin/bash web5 /home/web5
    2013-03-06 15:06 h1.wwweiss.de Debug Calling function 'insert' from plugin 'shelluser_jailkit_plugin' raised by event 'shell_user_insert'.
    2013-03-06 15:06 h1.wwweiss.de Debug Disabling shelluser temporarily: usermod -s /bin/false -L autobendert1 2>/dev/null
    2013-03-06 15:06 h1.wwweiss.de Debug ssh-rsa key updated in /var/www/clients/client5/web5/.ssh/authorized_keys
    2013-03-06 15:06 h1.wwweiss.de Debug ssh-rsa setup shelluser_base
    2013-03-06 15:06 h1.wwweiss.de Debug Added shelluser: autobendert1
    2013-03-06 15:06 h1.wwweiss.de Debug Executed command: useradd -d /var/www/clients/client5/web5 -g client5 -o -p $1$mYL4C1uQ$.5GEa4tLEYBf4W/e7UZ/Z/ -s /bin/bash -u 5005 autobendert1
    2013-03-06 15:06 h1.wwweiss.de Debug Calling function 'insert' from plugin 'shelluser_base_plugin' raised by event 'shell_user_insert'.
    2013-03-06 15:06 h1.wwweiss.de Debug Found 1 changes, starting update process.


    I am not sure if this gives the relevant Infos, because I do not get any error, just the wrong entry in passwd.

    Can you see what is going wrong?
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    The output from system log is just part of the information. Relevant is the output you get on the shell while running the server.sh command as this output contains also error messages from external commands like useradd and usermod.
     
  5. wwweiss

    wwweiss New Member HowtoForge Supporter

    Running the server.sh from the Shell does not give more information. Here is the Output:

    07.03.2013-09:33 - DEBUG - Calling function 'insert' from plugin 'shelluser_base_plugin' raised by event 'shell_user_insert'.
    07.03.2013-09:33 - DEBUG - Executed command: useradd -d /var/www/clients/client5/web5 -g client5 -o -p \$1\$2F59+y2X\$F/9t3Oh1SVLGYoFOmSR2R/ -s /bin/bash -u 5005 autobendert2
    07.03.2013-09:33 - DEBUG - Added shelluser: autobendert2
    07.03.2013-09:33 - DEBUG - ssh-rsa setup shelluser_base
    07.03.2013-09:33 - DEBUG - ssh-rsa key updated in /var/www/clients/client5/web5/.ssh/authorized_keys
    07.03.2013-09:33 - DEBUG - Disabling shelluser temporarily: usermod -s /bin/false -L autobendert2 2>/dev/null
    07.03.2013-09:33 - DEBUG - Calling function 'insert' from plugin 'shelluser_jailkit_plugin' raised by event 'shell_user_insert'.
    07.03.2013-09:33 - DEBUG - Added jailkit user to chroot with command: /usr/local/ispconfig/server/scripts/create_jailkit_user.sh autobendert2 /var/www/clients/client5/web5 /home/autobendert2 /bin/bash web5 /home/web5
    07.03.2013-09:33 - DEBUG - Added created jailkit user home in : /var/www/clients/client5/web5/home/autobendert2
    07.03.2013-09:33 - DEBUG - Added jailkit parent user home in : /var/www/clients/client5/web5/home/web5
    07.03.2013-09:33 - DEBUG - ssh-rsa setup shelluser_jailkit
    07.03.2013-09:33 - DEBUG - ssh-rsa authorisation keyfile created in /var/www/clients/client5/web5//home/autobendert2/.ssh/authorized_keys
    07.03.2013-09:33 - DEBUG - ssh-rsa key updated in /var/www/clients/client5/web5//home/autobendert2/.ssh/authorized_keys
    07.03.2013-09:33 - DEBUG - Jailkit Plugin -> insert username:autobendert2
    07.03.2013-09:33 - DEBUG - Processed datalog_id 102
    07.03.2013-09:33 - DEBUG - Remove Lock: /usr/local/ispconfig/server/temp/.ispconfig_lock

    I think something is going wrong with my Jailkit installation. Which process is responsible for writing the passwd file? Because I don't get any error Messages I think I made an error somewhere in the configuration. Everything seems to work correctly, just writes the wrong data to passwd.
     
  6. wwweiss

    wwweiss New Member HowtoForge Supporter

    I made some more tests and found the following. Looking to the script /usr/local/ispconfig/server/scripts/create_jailkit_user.sh I made the commands listet there directly from the shell, so I did:

    useradd -g 5006 -u 5005 -o shtest
    jk_jailuser -n -s /bin/bash -j /var/www/clients/client5/web5/ shtest

    After these two lines everything is written correctly. Seems that some other commands make the entries in the passwd file wrong afterwards.
     

Share This Page