在Centos中ssh user01@localhost -p 2021 报错权限不足
时间: 2023-05-21 18:06:34 浏览: 81
这可能是因为您没有足够的权限来连接到该端口。您可以尝试使用sudo来提升您的权限,例如:
sudo ssh user01@localhost -p 2021
如果您仍然无法连接,请确保您的ssh服务正在运行并且端口2021没有被防火墙阻止。
相关问题
centos进行gitosis源代码安装
在 CentOS 上安装 Gitosis 的步骤与 Ubuntu 上类似,只需要稍作修改即可。下面是 CentOS 上安装 Gitosis 的步骤:
1. 安装 Git 和 Python:
```
sudo yum install git-core python
```
2. 创建一个名为 git 的用户:
```
sudo adduser --system --shell /bin/bash --comment 'git version control' --user-group --home /home/git git
```
3. 用 git 用户身份登录,并创建一个新的 SSH 密钥:
```
sudo su git
ssh-keygen -t rsa
```
4. 将公钥添加到 Gitosis 的管理员仓库:
```
sudo yum install gitosis
sudo -H -u git gitosis-init < ~/.ssh/id_rsa.pub
```
5. 将 Gitosis 管理员仓库克隆到本地:
```
git clone git@localhost:gitosis-admin.git
```
6. 编辑 gitosis.conf 文件,添加需要管理的仓库:
```
cd gitosis-admin
nano gitosis.conf
```
7. 提交并推送更改:
```
git add gitosis.conf
git commit -m "Added new repository"
git push
```
现在,你就可以使用 SSH 公钥来访问 Git 仓库了。如果需要添加或删除用户的访问权限,只需要编辑 gitosis.conf 文件并提交更改即可。
centos如何源代码安装gitosis
在 CentOS 上安装 Gitosis 需要按照以下步骤进行操作:
1. 安装 Git 和 Python:
```
sudo yum install git-core python
```
2. 创建一个名为 git 的用户:
```
sudo useradd --system --shell /bin/bash --comment 'git version control' --user-group --home /home/git git
```
3. 切换到 git 用户,并生成一对新的 SSH 密钥:
```
sudo su git
ssh-keygen -t rsa
```
4. 安装 Gitosis:
```
cd /tmp
git clone https://github.com/tv42/gitosis.git
cd gitosis
python setup.py install
```
5. 初始化 Gitosis 管理员仓库:
```
sudo -H -u git gitosis-init < ~/.ssh/id_rsa.pub
```
6. 将 Gitosis 管理员仓库克隆到本地:
```
git clone git@localhost:gitosis-admin.git
```
7. 编辑 gitosis.conf 文件,添加需要管理的仓库:
```
cd gitosis-admin
nano gitosis.conf
```
8. 提交并推送更改:
```
git add gitosis.conf
git commit -m "Added new repository"
git push
```
现在,你就可以使用 SSH 公钥来访问 Git 仓库了。如果需要添加或删除用户的访问权限,只需要编辑 gitosis.conf 文件并提交更改即可。
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)