Skip to content
This repository has been archived by the owner on Mar 21, 2021. It is now read-only.

Commit

Permalink
docs(tomcat): 非root用户运行tomcat
Browse files Browse the repository at this point in the history
  • Loading branch information
zjZSTU committed Oct 28, 2019
1 parent 5d424b7 commit e7cd990
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
3 changes: 2 additions & 1 deletion docs/source/tomcat.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ tomcat
:caption: 目录:

tomcat/关于Tomcat
tomcat/[Ubuntu 16.02]Tomcat9安装
tomcat/[Ubuntu 16.02]Tomcat9安装
tomcat/[Ubuntu 16.02]非root用户运行
39 changes: 39 additions & 0 deletions docs/source/tomcat/[Ubuntu 16.02]非root用户运行.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@

# 非root用户运行

参考:

[用非root用户启动tomcat进程](https://rorschachchan.github.io/2018/04/18/%E4%BD%BF%E7%94%A8%E6%99%AE%E9%80%9A%E7%94%A8%E6%88%B7%E5%90%AF%E5%8A%A8tomcat/)

[How To Install Apache Tomcat 8 on Ubuntu 16.04](https://www.digitalocean.com/community/tutorials/how-to-install-apache-tomcat-8-on-ubuntu-16-04)

[Tomcat用普通用户身份运行](http://www.zhengdazhi.com/archives/1382)

默认安装的`tomcat``root`用户运行,为保证其安全性,进一步设置`tomcat`以普通用户运行

## 实现一

创建新用户`tomcat`

```
$ useradd tomcat
$ sudo usermod -aG root tomcat
```

`apache tomcat`文件夹设置为`tomcat`

```
$ sudo chown -R tomcat:tomcat apache-tomcat-9.0.27
```

切换到`tomcat`用户后进行启动即可;如果是开机自启动,则修改`/etc/rc.local`

```
su tomcat -c "/opt/apache-tomcat-9.0.27/bin/startup.sh"
```

这篇文章[How To Install Apache Tomcat 8 on Ubuntu 16.04](https://www.digitalocean.com/community/tutorials/how-to-install-apache-tomcat-8-on-ubuntu-16-04)也介绍的很详细

## 实现二

`tomcat`提供了工具`jsvc`,允许`tomcat`以非`root`用户运行,参考[Unixroot daemon](https://tomcat.apache.org/tomcat-9.0-doc/setup.html)

0 comments on commit e7cd990

Please sign in to comment.