Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在Google Cloud中更改或获取Linux Debian服务器的密码?_Linux_Google Cloud Platform_Debian - Fatal编程技术网

如何在Google Cloud中更改或获取Linux Debian服务器的密码?

如何在Google Cloud中更改或获取Linux Debian服务器的密码?,linux,google-cloud-platform,debian,Linux,Google Cloud Platform,Debian,我试图在我的Debian linux SSH服务器上运行脚本,但当我使用一些命令时,它会显示“权限被拒绝”和“未找到文件”。 下面是完整的代码和命令 我已经试过passwd,但我不知道旧密码,因为谷歌没有给我看。我也试过keygentool,但生成的密钥不起作用 sudo apt-get -y update sudo apt-get install -y ntpdate sudo apt-get install -y squid3 apache2-utils sudo cp /etc/sq

我试图在我的Debian linux SSH服务器上运行脚本,但当我使用一些命令时,它会显示“权限被拒绝”和“未找到文件”。 下面是完整的代码和命令

我已经试过passwd,但我不知道旧密码,因为谷歌没有给我看。我也试过keygentool,但生成的密钥不起作用

sudo apt-get -y update 
sudo apt-get install -y ntpdate 
sudo apt-get install -y squid3 apache2-utils 
sudo cp /etc/squid/squid.conf /etc/squid/squid.conf.bak 
sudo bash -c 'cat « EOF > /etc/squid/squid.conf 
http_port 80 
auth_param basic children 5 
auth_param basic credentialsttl 2 hours 
auth_param basic casesensitive off 
acl localhost src 
acl localnet src YOUR IP SERVER
http_access allow localhost 
http_access allow localnet 
http_access deny all 
cache deny all 
forwarded_for delete 
request_header_access Via deny all 
EOF' 
sudo /etc/init.d/squid restart

这些不起作用

sudo bash -c 'cat « EOF > /etc/squid/squid.conf 

拒绝许可

所有“未找到”


您可以通过运行
sudo su-
切换到root

另一个解决方案是使用启动脚本

通过元数据服务器指定

您可以向正在运行的实例添加启动脚本

1-从实例详细信息页面,完成以下步骤:

2-单击页面顶部的编辑按钮

3在自定义元数据下,单击添加项

4-使用以下键之一添加启动脚本:

启动脚本
:使用此键直接提供启动脚本内容

启动脚本url
:使用此键向启动脚本文件提供Google云存储url。 如果无法重新启动实例以运行启动脚本,则可以通过以下命令行在实例内重新运行启动脚本:

sudo google_metadata_script_runner --script-type startup --debug
sudo google_metadata_script_runner --script-type startup --debug