CentOS 7服务器上root安装的PowerMTA需由非root用户sam运行且浏览器无法访问的问题求助
Hey there, let's work through this issue step by step. The error "your cache administrator is root." is a clear clue that PowerMTA's web interface is either running as root (which it shouldn't) or trying to access cache/files owned by root that the non-root user sam can't properly handle. Here's how to fix this:
1. Verify if PowerMTA is actually running as user sam
First, check which user is running the PowerMTA process. Run this command in your terminal:
ps aux | grep -E "(pmta|PowerMTA)"
Look at the second column (the user) for the PowerMTA process. If it shows root, we need to adjust the configuration to force it to run as sam.
2. Configure PowerMTA to run as sam
Edit PowerMTA's main configuration file (usually located at /etc/pmta/config or /opt/pmta/config depending on your installation path). Look for the User and Group directives – if they're set to root, change them to:
User sam Group sam
Save the file, then restart the PowerMTA service to apply the change:
systemctl restart pmta
If you're using an older init system instead of systemd, use:
service pmta restart
3. Fix file/directory ownership for PowerMTA
Since you installed PowerMTA as root, almost all its files and directories are owned by root. sam needs proper read/write access to these to run the app and serve the web interface. Run these commands to recursively change ownership (adjust paths if your installation is in a different location):
# Change ownership of the main installation directory chown -R sam:sam /opt/pmta # Change ownership of configuration files chown -R sam:sam /etc/pmta # Change ownership of log files and cache directories chown -R sam:sam /var/log/pmta chown -R sam:sam /var/cache/pmta
The /var/cache/pmta path is critical here – this is likely where the web interface stores its cache files, which is why you're seeing the "cache administrator is root" error.
4. Verify the web interface port is accessible (optional but good to check)
While the error message points to permission issues, it's worth double-checking that port 8080 is open on your CentOS 7 firewall:
firewall-cmd --add-port=8080/tcp --permanent firewall-cmd --reload
After completing these steps, try accessing the PowerMTA web interface again. The error should be gone, and you should be able to use it normally via your browser.
备注:内容来源于stack exchange,提问作者 Sayantan

