Home  >  Q&A  >  body text

linux - Problem about gedit not having permission to save in ubuntu

Mine is an ubuntu system under a virtual machine

After obtaining root permissions, use gedit to create a file. The window will be stuck and you cannot enter the code

Cannot save without root permission. I don’t know what to do

某草草某草草2704 days ago1509

reply all(3)I'll reply

  • 黄舟

    黄舟2017-05-24 11:34:01

    1. If you don’t have permission, you can use sudo gedit main.c to execute it, or add permissions to the file sudo chmod 777 main.c

    2. The reason why it is stuck is because of ctrl+z. This is not a normal shutdown or a forced shutdown. It is a background execution. If you open this program without closing it, there will definitely be problems. If you want to force close, use ctrl+c.

    reply
    0
  • 为情所困

    为情所困2017-05-24 11:34:01

    1. Add permissions, sudo gedit main.c

    2. Modify permissions: sudo chmod 777 main.c

    3. Or edit directly with vim. There is a vim called vim, which is vim with root permissions

    4. The easiest thing is to switch directly to root

    $su -
    input your password
    $vim main.c

    reply
    0
  • 世界只因有你

    世界只因有你2017-05-24 11:34:01

    Give the sudo command to try to speed up:

    hostname # 查看当前登录用户主机名,记录下显示的名称
    sudo chmod 777 /etc/hosts # 这个时候可能会很慢,光标一直在闪,等待
    gedit /etc/hosts
    # 添加如下内容
    127.0.0.1 hostname
    sudo chmod 755 /etc/hosts

    Then try again

    reply
    0
  • Cancelreply