You need to be outside of any folder or file or directory and You must Be in root user mode sudo -s or sudo su.
sudo useradd -d /var/www username
sudo passwd username
nano /etc/ssh/sshd_config
subsystem sftp internal-sftp #(Ignore this line if it is already there in the file, just uncomment the exsisting line.)
Match User username
ChrootDirectory %h
AllowTCPForwarding no
X11Forwarding no
ForceCommand internal-sftp
sudo chown -R username:username /var/www/pterodactyl
sudo chmod -R 755 /var/www/pterodactyl
sudo service ssh restart
sudo systemctl restart sshd
Note
The Port 22 Shoud Be Opened In The Firewall.