---
title: "Ubuntu 创建低权限SSH用户"
id: "1645"
type: "post"
slug: "ubuntu-%e5%88%9b%e5%bb%ba%e4%bd%8e%e6%9d%83%e9%99%90ssh%e7%94%a8%e6%88%b7"
published_at: "2018-02-05T16:42:57+00:00"
modified_at: "2018-02-05T16:42:57+00:00"
url: "https://seq.ink/all/coding/1645.html"
markdown_url: "https://seq.ink/all/coding/1645.html.md"
excerpt: "useradd -M -s /sbin/nologin -n username ubuntu 下对应的 shell 应该是 `/bin/false`, CentOS 才是 `/sbin/nologin` 所以应该是 useradd -M - ..."
taxonomy_category:
  - "Coding代码堆"
  - "Live日常"
  - "Share分享"
---

```
useradd -M -s /sbin/nologin -n username
```

ubuntu 下对应的 shell 应该是 `/bin/false`, CentOS 才是 `/sbin/nologin`

所以应该是

```
useradd -M -s /bin/false -n username
```

修正错误

```
chsh username -s /bin/bash
```

参考地址 [https://www.v2ex.com/t/123803](https://www.v2ex.com/t/123803)
