summaryrefslogtreecommitdiff
path: root/src/conf_mode
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-05-02 11:28:28 +0200
committerChristian Poessinger <christian@poessinger.com>2021-05-02 17:13:40 +0200
commite17475f0237576c3b581daa7b8df1e48adfce8e9 (patch)
treec4f1c29fa3af40205a25aa66d8d346af41d0279d /src/conf_mode
parentc5dcb3748fdb0f04bb374240dbaa6747c58dfcb0 (diff)
downloadvyos-1x-e17475f0237576c3b581daa7b8df1e48adfce8e9.tar.gz
vyos-1x-e17475f0237576c3b581daa7b8df1e48adfce8e9.zip
login: T1948: use long options when calling adduser
... just to make it easier for users to read the commandline.
Diffstat (limited to 'src/conf_mode')
-rwxr-xr-xsrc/conf_mode/system-login.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/conf_mode/system-login.py b/src/conf_mode/system-login.py
index c8b81d80a..da0fc2a25 100755
--- a/src/conf_mode/system-login.py
+++ b/src/conf_mode/system-login.py
@@ -209,27 +209,27 @@ def apply(login):
for user, user_config in login['user'].items():
# make new user using vyatta shell and make home directory (-m),
# default group of 100 (users)
- command = 'useradd -m -N'
+ command = 'useradd --create-home --no-user-group'
# check if user already exists:
if user in get_local_users():
# update existing account
command = 'usermod'
# all accounts use /bin/vbash
- command += ' -s /bin/vbash'
+ command += ' --shell /bin/vbash'
# we need to use '' quotes when passing formatted data to the shell
# else it will not work as some data parts are lost in translation
tmp = dict_search('authentication.encrypted_password', user_config)
- if tmp: command += f" -p '{tmp}'"
+ if tmp: command += f" --password '{tmp}'"
tmp = dict_search('full_name', user_config)
- if tmp: command += f" -c '{tmp}'"
+ if tmp: command += f" --comment '{tmp}'"
tmp = dict_search('home_directory', user_config)
- if tmp: command += f" -d '{tmp}'"
- else: command += f" -d '/home/{user}'"
+ if tmp: command += f" --home '{tmp}'"
+ else: command += f" --home '/home/{user}'"
- command += f' -G frrvty,vyattacfg,sudo,adm,dip,disk {user}'
+ command += f' --groups frrvty,vyattacfg,sudo,adm,dip,disk {user}'
try:
cmd(command)
@@ -254,7 +254,7 @@ def apply(login):
call(f'pkill -HUP -u {user}')
# Remove user account but leave home directory to be safe
- call(f'userdel -r {user}', stderr=DEVNULL)
+ call(f'userdel --remove {user}', stderr=DEVNULL)
except Exception as e:
raise ConfigError(f'Deleting user "{user}" raised exception: {e}')