a guest May 23rd, 2018 145 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 1.
  2.     Open your .htacces file
  3.     Look for Options Indexes
  4.     If Options Indexes exists modify it to Options -Indexes or else add Options -Indexes as a new line
  5.     The directory browsing feature should be disable by now
  7. 2.
  8.    1. Stop the mysqld daemon process.
  9.    2. Start the mysqld daemon process with the –skip-grant-tables option.
  10.    3. Start the mysql client with the -u root option.
  11.    4. Execute UPDATE mysql.user SET Password=PASSWORD(‘inctfmysql’) WHERE User=’root’;
  12.    5. Execute FLUSH PRIVILEGES;
  14. These steps reset the password for the “root” account to “password.” To change the password for a different account or to set a
  16. different password, just edit the variables in single quotes in step 4.
  18. 3.No. Apache need not run as root user. The default is www-data(user) www-data(group).
  21. 4.
  22. Location of apache configuration file in Ubuntu: /etc/apache2/httpd.conf
  23. To change the document root for a site:
  24. 1.  sudo gedit /etc/apache2/sites-available/default
  25. 2.  Change the Directory directive, replace <Directory /var/www/> to <Directory /var/NewFolder/>
  27. 5.
  28. Location of error logs for apache in Ubuntu : /var/log/apache2/error.log
  30. 6.
  31. In order to query the database using PHP, APIs such as MYSQLi can be used.
  32. In order to administer the database, a secure connection can established using SSH to execute commands on the remote system with
  34. the help of libssh2.
  35. Example:
  36. To remotely change the password of a mysql user 'xyz' through php,
  37. if (!function_exists("ssh2_connect")) die("function ssh2_connect doesn't exist");
  38. // log in at on port 22
  39. if(!($con = ssh2_connect("", 22))){
  40.     echo "fail: unable to establish connection\n";
  41. } else {
  42.     // try to authenticate with username root, password secretpassword
  43.     if(!ssh2_auth_password($con, "root", "secretpassword")) {
  44.         echo "fail: unable to authenticate\n";
  45.     } else {
  46.         // allright, we're in!
  47.         echo "okay: logged in...\n";
  49.         // execute a command
  50.         ssh2_exec($con, "/etc/init.d/mysql stop" );
  51.     ssh2_exec($con, "/etc/init.d/mysql start --skip-grant-tables" );
  52.         ssh2_exec($con, "mysql -u xyz UPDATE mysql.user SET Password=PASSWORD(‘inctfmysql’) WHERE User=’xyz’;FLUSH PRIVILEGES;");
  55.         }
  56.     }
  57. }
  60. 7.
  61. Secure Shell (SSH) is a network protocol for secure data communication, remote shell services or command execution and other
  63. secure network services between two networked computers that it connects via a secure channel over an insecure network: a server
  65. and a client.
  66. Uses are:
  67.     For login to a shell on a remote host
  68.     For executing a single command on a remote host
  69.     Secure file transfer
  70.     In combination with rsync to back up, copy and mirror files efficiently and securely
  71.     For forwarding or tunneling a port (not to be confused with a VPN, which routes packets between different networks, or
  73. bridges two broadcast domains into one).
  74.     For forwarding X from a remote host (possible through multiple intermediate hosts)
  75.     For browsing the web through an encrypted proxy connection with SSH clients that support the SOCKS protocol.
  76.     For securely mounting a directory on a remote server as a filesystem on a local computer using SSHFS.
  77.     For automated remote monitoring and management of servers through one or more of the mechanisms discussed above.
  78.     For development on a mobile or embedded device that supports SSH.
  80. The default port for SSH is 22, but it can be changed to any other port number.
  81. The location of the config file is : /etc/ssh/sshd_config
  83. 8.
  84. write a shell script to execute the file(here a.out):
  86.        /root/xzy/a.out &
  87.   Appending the '&' sends the process in background
  88. Copy the script in /etc/init.d/
  89. Add the script as a service in the start-up sequence:
  90.     sudo update-rc.d default
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand