@pcdesign

Как запустить systemd если пользователя зовут «217»?

Создал юзера jasttest. В его домашнюю папку /home/jasttest/www/ положил два файла:

# main.py
from flask import Flask
app = Flask(__name__)

@app.route('/')
def hello_world():
    return 'Hello World!'

if __name__ == '__main__':
    app.run()


И

# webserver.sh
#!/bin/bash

HOME=/home/jasttest
VENVDIR=$HOME/env/bin
BINDIR=$HOME/www

cd $BINDIR
source $VENVDIR/activate
/home/jasttest/env/bin/gunicorn  -b localhost:8001  main:app


И в папку /usr/lib/systemd/system положил от рута файл:
[Unit]
Description=W2 Web App gunicorn
After=network.target

[Service]
Type=simple
User=jasttest
Group=jasttest
ExecStart=/home/jasttest/www/webserver.sh

[Install]
WantedBy=multi-user.target


И все отлично работает.
Демон запускается. На 8001 порту отвечает.

Делаю все один в один, но юзер на этот раз не jasttest, а 217.

И нифига не работает.

systemctl status gunicorn.service         
? gunicorn.service - Web App gunicorn
   Loaded: loaded (/usr/lib/systemd/system/gunicorn.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Sun 2016-01-24 12:04:35 MSK; 9s ago
  Process: 3347 ExecStart=/home/217/www/webserver.sh (code=exited, status=217/USER)
 Main PID: 3347 (code=exited, status=217/USER)

Jan 24 12:04:35 new217.localdomain systemd[1]: Started Web App gunicorn.
Jan 24 12:04:35 new217.localdomain systemd[1]: Starting Web App gunicorn...
Jan 24 12:04:35 new217.localdomain systemd[1]: gunicorn.service: main process exited, code=exited, status=217/USER
Jan 24 12:04:35 new217.localdomain systemd[1]: Unit gunicorn.service entered failed state.
Jan 24 12:04:35 new217.localdomain systemd[1]: gunicorn.service failed.
[root@new217 system]# 
[root@new217 system]# 
[root@new217 system]# 
[root@new217 system]# journalctl -xn
-- Logs begin at Sun 2016-01-24 10:27:06 MSK, end at Sun 2016-01-24 12:04:35 MSK. --
Jan 24 12:01:01 new217.localdomain run-parts(/etc/cron.hourly)[3331]: starting 0yum-hourly.cron
Jan 24 12:01:01 new217.localdomain run-parts(/etc/cron.hourly)[3335]: finished 0yum-hourly.cron
Jan 24 12:04:35 new217.localdomain polkitd[634]: Registered Authentication Agent for unix-process:3342:585028 (system bus name :1.59 [/usr/bin/pkttyagent --notify-fd 5 --fallback], object p
Jan 24 12:04:35 new217.localdomain systemd[1]: Started Web App gunicorn.
-- Subject: Unit gunicorn.service has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit gunicorn.service has finished starting up.
-- 
-- The start-up result is done.
Jan 24 12:04:35 new217.localdomain systemd[1]: Starting Web App gunicorn...
-- Subject: Unit gunicorn.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit gunicorn.service has begun starting up.
Jan 24 12:04:35 new217.localdomain systemd[3347]: Failed at step USER spawning /home/217/www/webserver.sh: No such process
-- Subject: Process /home/217/www/webserver.sh could not be executed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- The process /home/217/www/webserver.sh could not be executed and failed.
-- 
-- The error number returned by this process is 3.
Jan 24 12:04:35 new217.localdomain systemd[1]: gunicorn.service: main process exited, code=exited, status=217/USER
Jan 24 12:04:35 new217.localdomain systemd[1]: Unit gunicorn.service entered failed state.
Jan 24 12:04:35 new217.localdomain systemd[1]: gunicorn.service failed.
Jan 24 12:04:35 new217.localdomain polkitd[634]: Unregistered Authentication Agent for unix-process:3342:585028 (system bus name :1.59, object path /org/freedesktop/PolicyKit1/Authenticatio
[root@new217 system]#


Что это за прикол такой связанный с именем юзера?
  • Вопрос задан
  • 2396 просмотров
Решения вопроса 1
sim3x
@sim3x
Юзер не может иметь имя "217"
User/group names must match [a-z_][a-z0-9_-]*[$]

unix.stackexchange.com/a/157431
Ответ написан
Комментировать
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы