Open root directory linux

Как зайти под root в Ubuntu

Политика дистрибутива Ubuntu нацелена на то, что все действия, требующих административных привилегий надо выполнять с помощью команды sudo. Использовать root пользователя как основного для новичков опасно, поскольку они ещё плохо ориентируются в системе и могут забыть, что они вошли как root и удалить что-то важное.

А поскольку восстановить файлы, удалённые с помощью команды rm почти нельзя, то лучше новичков туда не пускать. Но иногда возникает необходимость войти под пользователем root. В этой небольшой статье мы рассмотрим как это сделать.

Как зайти под root в Ubuntu

По причинам, описанным выше для пользователя root пароль в Ubuntu не задан по умолчанию, поэтому вы не можете просто так войти от его имени с помощью в виртуальных консолях доступных по Ctrl+Alt+FN или с помощью утилиты su. Поскольку пароля нет, ввести его верно вы не сможете.

Но это всё очень просто обходится. Для того чтобы войти под пользователем root в терминале достаточно дописать sudo перед командой su:

Также можно использовать опцию -i команды sudo чтобы открыть консоль от имени суперпользователя:

Однако, если вы хотите авторизоваться от имени этого пользователя в виртуальной консоли или по SSH, то вам надо сначала задать для него пароль. Для этого выполните:

sudo passwd root

Затем введите два раза пароль. После этого пользователь root становится почти полноценным пользователем системы. Вы не сможете только войти под ним в графический интерфейс потому что на это действует ограничение самой оболочки Gnome, это очень плохая практика — запускать целую оболочку от имени root.

Но если вам всё же очень хочется, надо немного настроить правила PAM для GDM. Для этого откройте файл /etc/pam.d/gdm-password и закомментируйте там строчку:

sudo vi /etc/pam.d/gdm-password

# auth required pam_succeed_if.so user != root quiet_success

После этого вы сможете авторизоваться от имени root в менеджере входа. Просто кликните по пункту Нет в списке, а затем введите логин root:

Перед вами откроется оболочка, запущенная от имени суперпользователя:

Это очень небезопасно, потому что любая программа может делать с вашим компьютером всё, что захочет и никто её не остановит. Фактически, первые версии Windows тоже работали в таком режиме и поэтому они были очень уязвимы к вирусам.

Источник

Linux Root Folders Explained

In this post, you will finally get the Linux root folders explained. You will learn how these folders are used by your Linux system and how you can use them.

When you open your file manager, you are usually located in your home directory. But if you go two levels up, you will see this set of directories:

This post exactly about all these directories. You can watch the video where these Linux root folders explained or continue reading below.

Linux Root folders

I won’t use the terminal here and I will show you some visual presentation. But you are of course are encouraged to open the terminal and explore all these directories. Let’s get started.

/ – The Root

Everything begins in your system from this directory. All your folders, hard drives, USB drivers, everything is located in this root folder. You cannot go above this directory.

Also, the root directory is designated by the slash sign.

The concept of the root directory may be difficult to understand for Windows users who are used to see something like disk C, disk D and disk E. In Linux, every disk is a represented as a folder that is mounted under this root directory.

This Linux Directory Structure may look like a mess, but believe me when you learn it, you will realize how much sense it makes.

Читайте также:  Права для запуска системных служб windows

/bin – Binaries

The /bin folder contains programs that are essential for the system to boot and run. So, if you destroy this folder, your system won’t boot and run.

These programs are stored in the binary format. In other words, they are not in text format. You cannot open and read the content of these programs. The advantage of such format is that a computer can read and execute these programs very fast.

/boot – Boot Files

It is easy to guess from the name. This folder is needed to boot your system. It contains the Linux kernel, initial RAM disk image for drives need at boot time, and the bootloader.

I also would like to point out that within this boot folder, you can find the grub folder that contains grub configuration files.

If you read my Arch Linux post, you should remember than I used this command to generate the GRUB configuration file.

The boot folder also contains the Linux kernel.

/dev – Device Nodes

Here, I need to introduce another important concept of Linux – everything is a file. The /dev folder contains files for all devices your Linux is able to recognize.

If you have some Linux experience, you may recall that when you mount a hard drive, you use a name such as /dev/sda1 . The sda is the name of a first hard drive recognized by your Linux kernel and it is located in the dev folder. When the disk is mounted, you see it as a folder in that mounting point.

You can also find here USB devices, CPU etc.

/etc – Configuration Files

The /etc folder comprises all system-wide configuration files and some shell scripts that are executed during the system boot. All files here are text files, so they are human readable.

If you ever did any system-wide configuration, you probably edited some files here.

For example, there is /etc/fstab file that contains a table of storage devices and their mounting points.

/home – Users’ Folder

The home directory contains a home folder for each regular user on your Linux system. For example, I have tow folders in my /home folder. ALU is my home folder. The second folder belongs to another user, whom I named User2. So, the home folder of every user is named by its username.

You have as many folders as many users you have on your system.

These users’ folders are where users store their private data such as documents, videos, picture, music etc. When you open your file manager or your terminal by default you are located in you user’s home folder. It is also often marked as

/lib – Libraries

You already know the /bin directory that contains programs, this /lin folder contains libraries required by those programs from the /bin folder.

A library is a set of functions that are shared between programs. Thus, this /lib folder is also essential for your system to work correctly.

/lost+found – Recovered Files

You will have this directory if you use the ext4 file system. Most of the modern Linux distros use ext4, so most likely you have this folder. This is a file system specific folder that is used for data recovery in case of file corruption. Unless something bad has happened, this folder should be empty on your system.

This /lost+found folder is produced on every separate partition. So, if your /home folder is on a separate partition, you should have this /lost+found folder in your home directory too.

/media – Automatic mount point

This folder is used for automatic mounting of removable media such as USB drives, CD-ROM etc. For example, if your system is configured for automatic mounting, when you insert a USB drive it will be mounted to this folder.

/mnt – Manual mount point

The /mnt folder is similar to the /media folder, it is also used to mount devices, but usually, it is used for manual mounting. You, of course, can manually mount your devices to /media , but to keep some order in your system it is better to separate these two mounting points.

/opt – Optional Software

This folder is not essential for your system to work. Usually, it is used to install commercial programs on your system. For example, my Dropbox installation is located in this folder.

Читайте также:  Как включить все потоки процессора windows

/proc – Kernel Files

This is a virtual file-system maintained by the Linux kernel. Usually, you do not touch anything in this folder. It is needed only for the kernel to run different processes.

/root – Root Home

This is the home directory of your root user. Don’t mix it with the / root directory. The / directory is the parental directory for the whole system, whereas this /root directory is the same as your user home directory but it is for the root account.

If you log in as a root, you will be located in this directory by default. This is a folder for private data and account specific setting of your root account.

/run – Early temp

The /run is a recently introduced folder that is actually a temporary file-system. It is used to store temporary files very early in system boot before the other temporary folders become available.

/sbin – System Binaries

Similar to /bin this folder contains binaries for essential system tasks but they are meant to be run by the super user, in other words, the administrator of the system.

/srv – Service Data

This directory contains service files installed on your system. For example, if you installed a web-served on your Linux system, it will be located in this folder.

/tmp – Temporary Files

This is just a place where programs store temporary files on your system. This directory is usually cleaned on reboot.

/usr – User Binaries

This is probably the largest folder after your home folder. It contains all programs used by a regular user.

I would like to stop little more on sub-directories of this /usr folder.

/usr/bin contains the programs installed by your Linux distribution. There are usually thousands of programs here.

The libraries for this /usr/bin executables are located in the /usr/lib folder.

The /usr/local doesn’t have any programs by default, but if you compile and install a program system-wide it will be placed here.

The most useful folder is /usr/share . It contains all the shared data used by the programs from /usr/bin .

All default configuration files, themes, icons, wallpapers, sound files are stored here, one more folder I would like to mention here is the /usr/share/doc folder, where you can find the documentation files for programs installed on your system.

/var – Variable Files

The /var contains files that are of variable content, so their content is not static and it constantly changes. For example, this is where the log files are stored. If you don’t know, a log file is a file that records all events happening in your system while it is running. These log files often help to find out if something is not working correctly in your system.

Conclusion

Now you have some clue about all those folders in your Linux system.

Please, feel free to add anything in the comments bellow in case I missed something.

Источник

Linux directory structure: /home and /root folders

This is our 6 th post on understanding first level directories in /. Knowing these folders in detail or at least what each is meant for will help you understand Linux/Unix in whole. we already covered below directories, please have a look at those to understand them. In this post we will see two more directories ie /home and /root directory. These directories are meant for similar purpose. The /root is meant for just root user and /home is for all the remaining users.

A brief intro to /home directory in Linux/Unix

The /home directory is a place where by default all user home directories are created.

OK, what are user home directories for?

These directories are a kind of personal place(Working space) for all the users other than root. There will be a separate folder for each user in /home directory. For example if you have a user called ‘Tom’, then his default home directory is /home/tom. We can change this default folder when creating user in Linux. Our Tom user can do what ever he wants in /home/tom folder where he have full rights on the files he created and owned in that folder.

The properties of /home folder?

1) A separate sub folder ie /home/ is present for each user.
2) Only user who owns this sub folder can access its content other than root user. So, tom user can not access Barbi user home directory content which is located at /home/barbi.
3) All his terminal properties, command history file, application setting files(

Читайте также:  Звуковые драйвера realtek для windows 10 последняя версия

/.ssh) etc everything is located in this folder.
4) System admins when try to implement quota for users they will implement it on /home directory. This /home directory should be mounted on a separate partition.

Each user home directory is important and frequently used directory for that user, we have alias name for it. This alias is set to

so that when ever user wants to navigate to his home directory, he do not have to use /home/ but just use below short cuts.

Источник

How To Open A Directory with Root Privileges In Ubuntu 20.04 LTS?

In Linux or Unix, you can perform almost any task by using a terminal. You need to have superuser privileges to perform tasks such as installation or removal of softwares, editing configuration files, etc.

Linux provides sudo command, to execute a command in privileged mode. Many users prefer to use GUI for some tasks, especially new users. Now suppose you want to move a file or folder that needs root permissions, how will you do that? By using the terminal you can do it easily.

If you are using GUI, some Debian based distributions such as Linux Mint; provide an option to open as root. In Ubuntu 20.04 and its some previous versions this option is disabled by default. In this article, we will discuss to enable this option in Ubuntu 20.04 and Xubuntu 20.04 LTS.

Nautilus

Nautilus is an official file manager for gnome desktops. It allows one to browse directories and open an application associated with them. It is also responsible for icon handling in gnome desktops. In Ubuntu, prior to version 17.10, you could use gksu or gksudo command to open the Nautilus file manager as root, then you can access a file or directory with the root permissions. To enable this option in later versions of Ubuntu including Ubuntu 20.04 or 18.04 you can follow the below steps.

Installing the nautilus admin tool

To enable open as administrator or root option, first, you need to install nautilus administrator tools in your system. To install this tool open terminal by pressing ctrl+alt+t and then execute the following commands in it-

First, update the apt package index –

Press y if ask for confirmation. Once it gets installed reload the file manager with the following command.

Using nautilus admin tool

Now nautilus administrator tool is installed in your system. When you right-click on a folder you will see an option to open it as administrator which means you can open a file or folder as an administrator or with root privileges. Look at the image below –

Once you click on open as administrator option it will prompt you for authentication as given in the image below. Enter your password and click on authenticate. This will open the directory with root permissions.

How to open a directory as root in Xubuntu 20.04 LTS

Xubuntu comes with the Xfce desktop environment which is a stable, light, and configurable desktop environment. Opening directory as root in Xubuntu is a little bit different from the Ubuntu because it uses DR Thunar as a default file manager instead of Nautilus.

Now to open a directory as root first, open the terminal by pressing ctrl+alt+t

And then execute the given command –

Once this command gets executed you will be prompted for the authentication as given in the image below –

Enter your password and click on authenticate. This will open the filesystem as root now you can perform tasks such as creating, moving, or deleting a file or directory that requires root permission.

Alternatively, you can use the following command –

This will also prompt you to enter your password, once it gets successfully authenticated it will open the filesystem as root.

Conclusion

Be careful while using nautilus as an administrator you may end up with editing a system file which can make your system unusable. So use this tool only when it is needed.

Ok, that’s all for now. If you want to say something on this topic, you can share your thoughts with us in the comments below.

Источник

Оцените статью