You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

通过SSH以Plesk域名系统用户身份连接AWS Lightsail遇权限问题求助

Fixing SSH Permission Denied for Plesk Domain Directory Access

Hey Robin, I know how frustrating it is to spend a whole day stuck on an SSH permission issue—let’s break this down and get you access to that /var/www/vhosts/domain.tld directory. The core problem here is that the directory is owned by Plesk’s domain-specific system user, not the ubuntu user you’ve been trying to use. Here’s what to do:

1. Identify the Correct Plesk System User

First, you need to use the system user that Plesk created for your domain, not ubuntu. To find this user:

  • Log into your Plesk panel
  • Navigate to your domain’s Hosting Settings
  • Look for the System User field—this is the user that owns /var/www/vhosts/domain.tld (it might look something like domain_tld or a custom username you set)

2. Set Up SSH Keys for the Plesk System User

Your existing key pair was configured for the ubuntu user, so we need to add the public key to the Plesk user’s authorized keys:

Option A: If you can access the server as root

  • SSH into the server as root first, then switch to the Plesk system user:
    su - your_plesk_system_username
    
  • Create the .ssh directory (if it doesn’t exist) and set proper permissions:
    mkdir -p ~/.ssh
    chmod 700 ~/.ssh
    
  • Append your public key (from key.pub) to the authorized_keys file:
    echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQ..." >> ~/.ssh/authorized_keys
    
  • Lock down the permissions on authorized_keys (critical for SSH to accept the key):
    chmod 600 ~/.ssh/authorized_keys
    

Option B: Use the Plesk Panel (no root access needed)

  • In Plesk, go to System Users (under your domain or Tools & Settings)
  • Edit the domain’s system user
  • Scroll to the SSH Keys section, paste your public key content, and save

3. Connect with the Correct User

Now use the Plesk system user to initiate the SSH connection—replace the username with the one you found earlier:

ssh -i key.pem -T your_plesk_system_username@your_server_ip

Once connected, you’ll be in the user’s home directory, and you can easily navigate to /var/www/vhosts/domain.tld (you’ll have full access since this user owns it).

4. Troubleshoot If You Still Get Permission Denied

If you’re still seeing the error, check these common issues:

  • Check SSH logs: Look at /var/log/auth.log on the server—this will tell you exactly why the key was rejected (e.g., wrong permissions, invalid key format)
  • Verify SSH config: Ensure /etc/ssh/sshd_config has PubkeyAuthentication yes enabled (and no user-specific restrictions blocking key login)
  • Local key permissions: Double-check that your local key.pem still has chmod 600 set—SSH will reject keys with overly open permissions

内容的提问来源于stack exchange,提问作者Robin Alexander

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.09 17:07:58