Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1.
- Open your .htacces file
- Look for Options Indexes
- If Options Indexes exists modify it to Options -Indexes or else add Options -Indexes as a new line
- The directory browsing feature should be disable by now
- 2.
- 1. Stop the mysqld daemon process.
- 2. Start the mysqld daemon process with the –skip-grant-tables option.
- 3. Start the mysql client with the -u root option.
- 4. Execute UPDATE mysql.user SET Password=PASSWORD(‘inctfmysql’) WHERE User=’root’;
- 5. Execute FLUSH PRIVILEGES;
- These steps reset the password for the “root” account to “password.” To change the password for a different account or to set a
- different password, just edit the variables in single quotes in step 4.
- 3.No. Apache need not run as root user. The default is www-data(user) www-data(group).
- 4.
- Location of apache configuration file in Ubuntu: /etc/apache2/httpd.conf
- To change the document root for a site:
- 1. sudo gedit /etc/apache2/sites-available/default
- 2. Change the Directory directive, replace <Directory /var/www/> to <Directory /var/NewFolder/>
- 5.
- Location of error logs for apache in Ubuntu : /var/log/apache2/error.log
- 6.
- In order to query the database using PHP, APIs such as MYSQLi can be used.
- In order to administer the database, a secure connection can established using SSH to execute commands on the remote system with
- the help of libssh2.
- Example:
- To remotely change the password of a mysql user 'xyz' through php,
- if (!function_exists("ssh2_connect")) die("function ssh2_connect doesn't exist");
- // log in at server1.example.com on port 22
- if(!($con = ssh2_connect("server1.example.com", 22))){
- echo "fail: unable to establish connection\n";
- } else {
- // try to authenticate with username root, password secretpassword
- if(!ssh2_auth_password($con, "root", "secretpassword")) {
- echo "fail: unable to authenticate\n";
- } else {
- // allright, we're in!
- echo "okay: logged in...\n";
- // execute a command
- ssh2_exec($con, "/etc/init.d/mysql stop" );
- ssh2_exec($con, "/etc/init.d/mysql start --skip-grant-tables" );
- ssh2_exec($con, "mysql -u xyz UPDATE mysql.user SET Password=PASSWORD(‘inctfmysql’) WHERE User=’xyz’;FLUSH PRIVILEGES;");
- }
- }
- }
- 7.
- Secure Shell (SSH) is a network protocol for secure data communication, remote shell services or command execution and other
- secure network services between two networked computers that it connects via a secure channel over an insecure network: a server
- and a client.
- Uses are:
- For login to a shell on a remote host
- For executing a single command on a remote host
- Secure file transfer
- In combination with rsync to back up, copy and mirror files efficiently and securely
- For forwarding or tunneling a port (not to be confused with a VPN, which routes packets between different networks, or
- bridges two broadcast domains into one).
- For forwarding X from a remote host (possible through multiple intermediate hosts)
- For browsing the web through an encrypted proxy connection with SSH clients that support the SOCKS protocol.
- For securely mounting a directory on a remote server as a filesystem on a local computer using SSHFS.
- For automated remote monitoring and management of servers through one or more of the mechanisms discussed above.
- For development on a mobile or embedded device that supports SSH.
- The default port for SSH is 22, but it can be changed to any other port number.
- The location of the config file is : /etc/ssh/sshd_config
- 8.
- write a shell script to execute the file(here a.out):
- myScript.sh
- /root/xzy/a.out &
- Appending the '&' sends the process in background
- Copy the script in /etc/init.d/
- Add the script as a service in the start-up sequence:
- sudo update-rc.d myScript.sh default
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement