Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Default shell not setting #3669

Closed
Steveorevo opened this issue Jun 10, 2023 · 5 comments · Fixed by #3671
Closed

[Bug] Default shell not setting #3669

Steveorevo opened this issue Jun 10, 2023 · 5 comments · Fixed by #3671
Labels
bug Something isn't working

Comments

@Steveorevo
Copy link
Contributor

Describe the bug

I have an automated install of Hestia using the CLI API, after installation I create a new package and new user:

# Create our pws user and package
cd /usr/local/hestia/bin
cat <<EOT >> /tmp/pws.txt
PACKAGE=pws
WEB_TEMPLATE=default
BACKEND_TEMPLATE=default
PROXY_TEMPLATE=default
DNS_TEMPLATE=default
WEB_DOMAINS=unlimited
WEB_ALIASES=unlimited
DNS_DOMAINS=unlimited
DNS_RECORDS=unlimited
MAIL_DOMAINS=unlimited
MAIL_ACCOUNTS=unlimited
RATE_LIMIT=200
DATABASES=unlimited
CRON_JOBS=unlimited
DISK_QUOTA=unlimited
BANDWIDTH=unlimited
NS=ns1.dev.cc,ns2.dev.cc
SHELL=/bin/bash
BACKUPS=0
EOT
./v-add-user-package /tmp/pws.txt pws
./v-add-user pws personal-web-server pws@dev.cc pws "Personal Web Server"
./v-update-user-package pws

I initially set SHELL=bash to no avail. A peek at /etc/passwd reveals:

pws:x:1004:1004:pws@dev.cc:/home/pws:

No shell set.

Workaround is to do a chsh -s /bin/bash pws but I'm wondering if it should/how-to set it properly.

Tell us how to replicate the bug

  1. Install HestiaCP
  2. Drop to root and execute the given commands:
# Create our pws user and package
cd /usr/local/hestia/bin
cat <<EOT >> /tmp/pws.txt
PACKAGE=pws
WEB_TEMPLATE=default
BACKEND_TEMPLATE=default
PROXY_TEMPLATE=default
DNS_TEMPLATE=default
WEB_DOMAINS=unlimited
WEB_ALIASES=unlimited
DNS_DOMAINS=unlimited
DNS_RECORDS=unlimited
MAIL_DOMAINS=unlimited
MAIL_ACCOUNTS=unlimited
RATE_LIMIT=200
DATABASES=unlimited
CRON_JOBS=unlimited
DISK_QUOTA=unlimited
BANDWIDTH=unlimited
NS=ns1.dev.cc,ns2.dev.cc
SHELL=bash
BACKUPS=0
EOT
./v-add-user-package /tmp/pws.txt pws
./v-add-user pws personal-web-server pws@dev.cc pws "Personal Web Server"
./v-update-user-package pws
  1. Attempt login as pws user, default shell is sh not bash. /etc/passwd shows to shell set.

Which components are affected by this bug?

Control Panel Command Line Interface

Hestia Control Panel Version

1.7.7

Operating system

Debian 11

Log capture

Error: shell SHELL=bash is not valid
Error: package pws already exists.
Error: user pws exists
Error: shell SHELL=/bin/bash is not valid
@Steveorevo Steveorevo added the bug Something isn't working label Jun 10, 2023
@jaapmarcus
Copy link
Member

jaapmarcus commented Jun 10, 2023

v-change-user-shell user bash

or use :

SHELL='bash'

@jaapmarcus
Copy link
Member

Just checked:

root@dev:/usr/local/hestia/data/packages# cat test.pkg
WEB_TEMPLATE='default'
BACKEND_TEMPLATE='default'
PROXY_TEMPLATE=
DNS_TEMPLATE='default'
WEB_DOMAINS='unlimited'
WEB_ALIASES='unlimited'
DNS_DOMAINS='unlimited'
DNS_RECORDS='unlimited'
MAIL_DOMAINS='unlimited'
MAIL_ACCOUNTS='unlimited'
RATE_LIMIT='200'
DATABASES='unlimited'
CRON_JOBS='0'
DISK_QUOTA='100000'
BANDWIDTH='100000'
NS='ns1.example.ltd,ns2.example.ltd'
SHELL='bash'
BACKUPS='0'
TIME='19:08:01'
DATE='2023-06-10'
root@dev:/usr/local/hestia/data/packages# v-add-user ik 1234 me@domain.com test
root@dev:/usr/local/hestia/data/packages# v-list-user ik
USERNAME: ik
FULL NAME:
EMAIL: me@domain.com
LANGUAGE:
THEME:
SUSPENDED: no
PACKAGE: test
SHELL: bash

@jaapmarcus
Copy link
Member

Use single quotes around bash. I think because we source

@jaapmarcus jaapmarcus reopened this Jun 10, 2023
@jaapmarcus
Copy link
Member

It looks like we need to

  1. Validate user input so each option is enclosed with ''
  2. Or add it our self...

@jaapmarcus
Copy link
Member

Was able replicate the issue in some random cases but:
#3671

Should fix the issue until then use single quotes ...

@jaapmarcus jaapmarcus linked a pull request Jun 10, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants