privateone commited on
Commit
d23feb0
·
verified ·
1 Parent(s): f174044

Update start.sh

Browse files
Files changed (1) hide show
  1. start.sh +5 -4
start.sh CHANGED
@@ -6,7 +6,7 @@ print_host_details() {
6
  echo "* The hostname of this container is: $(cat /etc/hostname). PWD $(pwd)"
7
  echo "* The host File of this container is: $(cat /etc/hosts)"
8
  echo "* The Sudoers of this container is: $(cat /etc/sudoers)"
9
- echo "* ID of the user running the script:($whoami) *ID : $(id -u) * Group: $(id -g)"
10
  echo "* Changing User to Admin :$(echo "toor" || su - admin)"
11
  echo "* Current User WHO AM I $(whoami)"
12
  echo "* Status of Admin: $(id admin 2>/dev/null || echo 'Admin user not found')"
@@ -15,8 +15,8 @@ print_host_details() {
15
  start_ssh_service() {
16
  if ! pgrep -x "sshd" >/dev/null; then
17
  echo "* Starting SSH server on port 2222 *"
18
- #/usr/sbin/sshd -p 2222 || { echo "Failed to start SSH server"; exit 1; }
19
- /usr/sbin/sshd -D -e -ddd|| { echo "Failed to start SSH server"; exit 1; }
20
  else
21
  echo "* SSH server is already running *"
22
  fi
@@ -63,7 +63,8 @@ echo "* Status of SSH service: *"
63
  netstat -tuln
64
 
65
  echo "* Testing admin's SSH login locally *"
66
- sshpass -p "password" ssh -v -o StrictHostKeyChecking=no -i /home/admin/.ssh/id_rsa admin@0.0.0.0 -p 2222
 
67
 
68
  activate_virtual_env
69
  set_working_directory
 
6
  echo "* The hostname of this container is: $(cat /etc/hostname). PWD $(pwd)"
7
  echo "* The host File of this container is: $(cat /etc/hosts)"
8
  echo "* The Sudoers of this container is: $(cat /etc/sudoers)"
9
+ echo "* ID of the user running the script:$(whoami) *ID : $(id -u) * Group: $(id -g)"
10
  echo "* Changing User to Admin :$(echo "toor" || su - admin)"
11
  echo "* Current User WHO AM I $(whoami)"
12
  echo "* Status of Admin: $(id admin 2>/dev/null || echo 'Admin user not found')"
 
15
  start_ssh_service() {
16
  if ! pgrep -x "sshd" >/dev/null; then
17
  echo "* Starting SSH server on port 2222 *"
18
+ /usr/sbin/sshd -p 2222 -e -ddd || { echo "Failed to start SSH server"; exit 1; }
19
+ #/usr/sbin/sshd -D -e -ddd|| { echo "Failed to start SSH server"; exit 1; }
20
  else
21
  echo "* SSH server is already running *"
22
  fi
 
63
  netstat -tuln
64
 
65
  echo "* Testing admin's SSH login locally *"
66
+ sshpass -p "password" ssh -v -o StrictHostKeyChecking=no -i /etc/ssh/ssh_host_rsa_key.pub admin@0.0.0.0 -p 2222
67
+
68
 
69
  activate_virtual_env
70
  set_working_directory