Ubuntu Access Отказано

Я использую Ubuntu 20 в Windows 10. Я пытался добавить каталог к ​​моей переменной пути, редактируя .profile Однако я могу сделать это только из командной строки, и мне не удалось сделать это с помощью gedit ~ / .profile из-за ошибки:

Unable to init server: Could not connect: Connection refused

(gedit:76): Gtk-WARNING **: 17:57:16.278: cannot open display:

Итак, я сделал то, о чем сейчас сожалею.

echo export PATH=$PATH:/path/to/add >> ./profile

Я сделал копию ./profile заранее. Но когда я перезапустил Ubuntu, я получил «Отказано в доступе»

. Любая помощь будет признательна.

@GunnarHjalmarsson

0
задан 25 June 2020 в 00:46

1 ответ

I highly recommend any new Windows Subsystem Linux (WSL) users to read through this great users guide: https://github.com/michaeltreat/Windows-Subsystem-For-Linux-Setup-Guide/

Section 3 dealt with my issue:

Ubuntu Files Now that you are in your Ubuntu User's root, type ls -a to show all hidden files. Notice that you have a .profile file. This is where your terminal's profile settings are stored. This is also an Ubuntu file because it is on the Ubuntu FS. You can't edit this file through Windows, or a Windows program or app, as it wouldn't work. You might see the changes show up in the file, but it will not be read correctly anymore. In the off chance that you do need to edit a Ubuntu file then you should use the built in code editor called nano, or use the CLI to install a different one. Just remember that you cannot use a GUI here, so you must edit Ubuntu files through the command line.

Good to know:

IMPORTANT: Anytime you uninstall the app and reinstall it you will lose any data that lives on the Linux Filesystem. This inlcudes databases, configs, .profile's, and anything else you might have stored on the NON-Windows Filesystem. Make sure to back this data up!

...while Ubuntu can read and write both Ubuntu and Windows files, Windows can only read and write Windows files, and read Ubuntu Files, but it cannot write Ubuntu files. Knowing which files belong to which FS важен из-за этого.

Оглядываясь назад, чтобы отредактировать ~ / .profile, @ db429 был прав, нужно использовать команду nano.

0
ответ дан 30 July 2020 в 22:20

Другие вопросы по тегам:

Похожие вопросы: