在CentOS 7 linux中编辑tomcat-users.xml [英] editing tomcat-users.xml in CentOS 7 linux

查看:1272
本文介绍了在CentOS 7 linux中编辑tomcat-users.xml的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正试图使用​​编辑 tomcat 8 中的 tomcat-users.xml > terminal CentOS 7 linux 。我键入 su - 使用终端作为 root 帐户。然后我输入 vi $ CATALINA_HOME / conf / tomcat-users.xml ,但结果是 vi 在只读模式下的 tomcat-users.xml 的内容的窗口,并且似乎没有出路 vi 除了关闭窗口,丢失所有终端历史。我还导航到 tomcat-users.xml 的物理位置,并使用 gedit 打开文件,但 gedit 将不允许我保存文件。 如何编辑 tomcat-users.xml

I am trying to edit tomcat-users.xml in tomcat 8, using the terminal of CentOS 7 linux. I typed su - to use the terminal as the root account. I then typed in vi $CATALINA_HOME/conf/tomcat-users.xml, but the result is that vi opens in the window with the contents of tomcat-users.xml in read-only mode, and there seems to be no way out of vi except to close the window, losing all the terminal history. I also navigated to the physical location of tomcat-users.xml and opened up the file using gedit, but gedit will not allow me to save the file. How can I edit tomcat-users.xml?

推荐答案

打开vi时,您处于命令模式。键入i将自己置于插入模式。进行编辑,然后在完成后使用escape键切换回命令模式。然后键入:q!退出而不保存或ZZ保存并关闭。我相信barjomet是正确的,作为根,:wq!将允许您写入只读文件。

When you open vi, you are in command mode. Type i to place yourself in insert mode. make your edits then when you are finished use the escape key to toggle back to command mode. Then type :q! to exit without saving or ZZ to save and close. I believe barjomet is correct that as root, :wq! will allow you to write to a read only file.

您可能想要调查为什么文件权限是只读的。使用带有-l选项的ls命令
查看谁拥有该文件以及权限是什么示例:
ls -l /some/folder/somefile.xml

you might want to investigate why the file permissions are read only. See who owns the file and what the permissions are by using the ls command with the -l option Example: ls -l /some/folder/somefile.xml

通过使用chmod命令更改权限(如果你知道你在做什么),并使用chown命令更改所有者(注意,不要搞乱权限并创建安全漏洞,我可以't帮助,因为我不知道tomcat)

change the permissions (if you know what you're doing) by using chmod command and change owner by using the chown command (be careful, don't mess up the permissions and create a security flaw, I can't help with that as I don't know tomcat)

这篇关于在CentOS 7 linux中编辑tomcat-users.xml的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆