mirror of
https://github.com/darksaid98/ubuntu-server-setup.git
synced 2026-12-02 06:28:59 +00:00
Added setup cleanup functions
This commit is contained in:
1 parent
244e4db9d9
commit
0c80eb4811
11 files changed
+35
-1549
No files matched your search
@@ -12,6 +12,9 @@ function includeDependencies() {
|
||||
source "${current_dir}/setupLibrary.sh"
|
||||
}
|
||||
|
||||
current_dir=$(getCurrentDir)
|
||||
includeDependencies
|
||||
|
||||
function setupSwap() {
|
||||
createSwap
|
||||
mountSwap
|
||||
@@ -19,8 +22,11 @@ function setupSwap() {
|
||||
saveSwapSettings
|
||||
}
|
||||
|
||||
current_dir=$(getCurrentDir)
|
||||
includeDependencies
|
||||
function cleanup() {
|
||||
if [[ -f "/etc/sudoers.bak" ]]; then
|
||||
revertSudoers
|
||||
fi
|
||||
}
|
||||
|
||||
read -p "Enter the username of the new user account:" username
|
||||
read -s -p "Enter new UNIX password:" password
|
||||
@@ -33,9 +39,12 @@ if [[ "${password}" != "${password_confirmation}" ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
trap cleanup EXIT SIGHUP SIGINT SIGTERM
|
||||
|
||||
addUserAccount "${username}" "${password}"
|
||||
|
||||
read -rp $'Paste in the public SSH key for the new user:\n' sshKey
|
||||
disableSudoPassword "${username}"
|
||||
addSSHKey "${username}" "${sshKey}"
|
||||
changeSSHConfig
|
||||
setupUfw
|
||||
@@ -43,4 +52,6 @@ setupSwap
|
||||
setTimezone "Asia/Singapore"
|
||||
configureNTP
|
||||
|
||||
sudo service ssh restart
|
||||
sudo service ssh restart
|
||||
|
||||
cleanup
|
||||
Reference in new issue
Block a user