Skip to content

Commit

Permalink
Merge pull request #13024 from alanmcanonical/fix_no_shelllogin_for_s…
Browse files Browse the repository at this point in the history
…ystemaccounts

[Ubuntu2404] Fix tests of no_shelllogin_for_systemaccounts
  • Loading branch information
dodys authored Feb 12, 2025
2 parents fb5157b + 604cf4e commit f507788
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,13 @@ sed -Ei '
}
/^'"$key"'/d;
' /etc/login.defs

key=SYS_UID_MIN

# Add key as 1st line, drop others
sed -Ei '
1{i\
'"$key"' 201
}
/^'"$key"'/d;
' /etc/login.defs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@
useradd --system --shell /sbin/nologin -u 999 sysuser
useradd -u {{{ uid_min }}} testuser

key=SYS_UID_MAX

# Add key as 1st line, drop others
sed -Ei '
1{i\
'"$key"' 999
}
/^'"$key"'/d;
' /etc/login.defs

key=SYS_UID_MIN

# Add key as 1st line, drop others
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
useradd --system --shell /sbin/nologin -u 999 sysuser
useradd -u {{{ uid_min }}} testuser

key=SYS_UID_MIN

printf "%s 201\n" "$key" >> /etc/login.defs

key=SYS_UID_MAX

# Add bogus key as 2nd last and valid last line w/o nl
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
useradd --system --shell /sbin/nologin -u 999 sysuser
useradd -u {{{ uid_min }}} testuser

key=SYS_UID_MAX

printf "%s 999\n" "$key" >> /etc/login.defs

key=SYS_UID_MIN

# Add bogus key as 2nd last and valid last line w/o nl
Expand Down

0 comments on commit f507788

Please sign in to comment.