Skip to content

Commit e1ca37c

Browse files
committed
Fixed a few issues in the user installation script.
- Added redirection of output to file. - Added code to comment out replacement values in sshd_config
1 parent 345fb4f commit e1ca37c

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

terra/root2.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ if [[ -d /root/.ssh ]]
1111
then
1212
echo -n "> Copying SSH keys to new user account..."
1313

14-
cp -r .ssh /home/$TERRA_USER
14+
cp -r /root/.ssh /home/$TERRA_USER
1515
chown -R $TERRA_USER:$TERRA_USER /home/$TERRA_USER/.ssh
1616
chmod 644 /home/$TERRA_USER/.ssh/authorized_keys
1717

@@ -33,6 +33,8 @@ echo " done."
3333

3434
echo -n "> Changing default SSH port, password login, and root configurations..."
3535

36+
sed -i'.bak1' -e 's/^PasswordAuthentication /#PasswordAuthentication /' /etc/ssh/sshd_config
37+
sed -i'.bak2' -e 's/^PermitRootLogin /#PermitRootLogin /' /etc/ssh/sshd_config
3638
echo "Port 9560" >> /etc/ssh/sshd_config
3739
echo "PasswordAuthentication no" >> /etc/ssh/sshd_config
3840
echo "PermitRootLogin no" >> /etc/ssh/sshd_config

terra/user1.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/bin/bash
22

3+
exec 3>&1 4>&2 >user1.sh.log 2>&1
4+
35
## Update the repos.
46
echo "Updating the system"
57
echo "==================="
@@ -19,9 +21,7 @@ echo "============="
1921
echo -n "Updating bash profile..."
2022
echo "export GOROOT=$GOROOT" >> ~/.profile
2123
echo "export GOPATH=$GOPATH" >> ~/.profile
22-
source ~/.profile
2324
echo "export PATH=$GOPATH/bin:$GOROOT/bin:$PATH" >> ~/.profile
24-
source ~/.profile
2525
echo " done."
2626

2727
echo "Software installation"
@@ -34,8 +34,9 @@ echo "-------------"
3434
cd /home/$USER/downloads
3535
curl -o go1.16.3.linux-amd64.tar.gz https://dl.google.com/go/go1.16.3.linux-amd64.tar.gz
3636
sudo tar -C /usr/local -zxvf go1.16.3.linux-amd64.tar.gz
37+
source ~/.profile
3738
echo -n "Installed "
38-
/usr/local/go/bin/go version
39+
go version
3940

4041
# Installation of terrad
4142
echo "Installing terrad"
@@ -100,3 +101,4 @@ cd /home/$USER/oracle-feeder/price-server
100101
echo "Making a default configuration file. REMEMBER TO CHANGE config/default.js"
101102
cp config/default-sample.js config/default.js
102103

104+
exec 1>&3 2>&4

0 commit comments

Comments
 (0)