paint-brush
Logging In to Bebian GNU/Linuxby@goerzenandothman
104 reads

Logging In to Bebian GNU/Linux

by Goerzen & OthmanOctober 25th, 2023
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

Your system is now installed! Pat yourself on the back for a job well done! Now it’s time to start using the system. In this chapter, we introduce you to the Debian command line, some security principles, and how to exit the system. In later chapters, we’ll go into more detail on these topics and introduce you to the Debian graphical interface, X11. 4.1 First Steps After you quit dselect, you’ll be presented with the login: prompt. You can now log in using the personal login and password you selected; your system is now ready to use. Let’s examine what it means to log in and how this process works. To use Debian, you must identify yourself to the system. This is so it knows who you are, what you have permission to do, and what your preferences are. To this end, you have a username or login. If you installed Debian yourself, you should have been asked to give such a name during installation. If you are logging on to a system administered by someone else, you’ll have to ask him for an account on the system and a corresponding username. You also have a password, so no one else can pretend to be you. If you don’t have a password, anyone can log on to your computer from the Internet and do bad things. If you’re worried about security, you should have a password. Many people prefer to trust others not to do anything malicious with their account; hopefully your work environment doesn’t encourage paranoia. This is a perfectly reasonable attitude; it depends on your personal priorities and your environment. Obviously a home system does not need to be as secure as a military installation. Debian allows you to be as secure or as insecure as you like. When you start Debian, you’ll see a prompt: a request from the computer for some information. In this case, the prompt is login:. You should type your username and, when requested, your password. The password does not appear on the screen as you type it. Press Enter after both the username and the password. If you type your username or password incorrectly, you’ll have to start over. If you do it correctly, you’ll see a brief message and then a $ prompt. The $ is printed by a special program called the shell and is thus called a shell prompt. This is where you give commands to the system. Try entering the command whoami now. There is a cursor to the right of the shell prompt. Your cursor is a small underscore or rectangle that indicates where you’re typing; it should move as you type. Always press Enter when you’re done typing a shell command. whoami tells your username. You’ll then get a new shell prompt. For the rest of the book, when we say to enter a command, you should type it at the shell prompt and press the Enter key. When you’re done working, you may want to log out of the system. To exit the shell, enter the exit command. Keep in mind that if you remain logged in, someone could come along and use your account. Hopefully you can trust those in your office or home not to do this; but if you do not trust your environment, you should be certain to log out when you leave.
featured image - Logging In to Bebian GNU/Linux
Goerzen & Othman HackerNoon profile picture

Debian GNU/Linux: Guide to Installation and Usage" by John Goerzen and Ossama Othman is part of the HackerNoon Books Series. You can jump to any chapter in this book here. Logging In

4. Logging In

Your system is now installed! Pat yourself on the back for a job well done! Now it’s time to start using the system. In this chapter, we introduce you to the Debian command line, some security principles, and how to exit the system. In later chapters, we’ll go into more detail on these topics and introduce you to the Debian graphical interface, X11.

4.1 First Steps

After you quit dselect, you’ll be presented with the login: prompt. You can now log in using the personal login and password you selected; your system is now ready to use. Let’s examine what it means to log in and how this process works.


To use Debian, you must identify yourself to the system. This is so it knows who you are, what you have permission to do, and what your preferences are.


To this end, you have a username or login. If you installed Debian yourself, you should have been asked to give such a name during installation. If you are logging on to a system administered by someone else, you’ll have to ask him for an account on the system and a corresponding username.


You also have a password, so no one else can pretend to be you. If you don’t have a password, anyone can log on to your computer from the Internet and do bad things. If you’re worried about security, you should have a password.


Many people prefer to trust others not to do anything malicious with their account; hopefully your work environment doesn’t encourage paranoia. This is a perfectly reasonable attitude; it depends on your personal priorities and your environment. Obviously a home system does not need to be as secure as a military installation. Debian allows you to be as secure or as insecure as you like.


When you start Debian, you’ll see a prompt: a request from the computer for some information. In this case, the prompt is login:.


You should type your username and, when requested, your password. The password does not appear on the screen as you type it. Press Enter after both the username and the password. If you type your username or password incorrectly, you’ll have to start over.


If you do it correctly, you’ll see a brief message and then a $ prompt. The $ is printed by a special program called the shell and is thus called a shell prompt. This is where you give commands to the system.


Try entering the command whoami now. There is a cursor to the right of the shell prompt. Your cursor is a small underscore or rectangle that indicates where you’re typing; it should move as you type. Always press Enter when you’re done typing a shell command.

whoami tells your username. You’ll then get a new shell prompt.


For the rest of the book, when we say to enter a command, you should type it at the shell prompt and press the Enter key.


When you’re done working, you may want to log out of the system. To exit the shell, enter the exit command. Keep in mind that if you remain logged in, someone could come along and use your account. Hopefully you can trust those in your office or home not to do this; but if you do not trust your environment, you should be certain to log out when you leave.

4.2 Command History and Editing the Command Line

Whatever you type after the shell prompt and before pressing Enter is called a command line. It’s a line of text that commands the computer to do something. The Debian default shell offers several features to make entering command lines easy.


You can scroll up to previous commands to run them again, or you can modify them slightly and then run them again. Try this: Enter any command, such as whoami; then press the Up Arrow key. The whoami command will reappear at the prompt. You can then press Enter to run whoami a second time.


If you’ve entered several commands, you can keep pressing the Up Arrow key to go back through them. This feature is handy if you’re doing the same thing several times, or if you type a command incorrectly and want to go back to fix it. You can press the Down Arrow key to move in the other direction, toward your more recent commands. If there are no more commands to move to, the computer will beep.


You can also move around on the command line to make changes. The easiest way is with the Left and Right Arrow keys. Try typing whoasmi instead of whoami, and then use the Left Arrow key to move back to the s. You can erase the s with the Backspace or Delete keys.


There are more advanced features as well (no need to memorize them all now, though). Try pressing Ctrl-a. This moves you to the beginning of the line. Ctrl-k (the k stands for “kill”) deletes all characters until the end of the line; try it from the middle of the command line. Using Ctrl-a followed by Ctrl-k, you can delete the entire command line. Ctrl-y pastes the last thing you killed, reinserting it at the current cursor position (y stands for “yank,” as in “yank it back”). Ctrl-e will move the cursor to the end of the command line.


Go ahead and play around with command-line editing to get a feel for it. Experiment.

4.3 Working as Root

Because Debian is a multiuser system, it’s designed to keep any one user or program from breaking the entire system. The kernel will not allow normal users to change important system files. This means that things stay the way they’re supposed to, safe from accidents, viruses, and even malicious pranks. Unlike other operating systems, Debian is safe from these threats. You won’t need an anti-virus program.


However, sometimes you need to change important system files; for example, you might want to install new software or configure your network connection. To do so, you have to have greater powers than a normal user; you must become the root user (also called the superuser).


To become root, just log on with the username root and the root password; this was set during installation, as described in section 3.15 on page [*].


At many sites, only the system administrator has the root password, and only the system administrator can do the things that one must be root to do. If you’re using your own personal computer, you are the system administrator, of course. If you don’t have root privileges, you will have to rely on your system administrator to perform any tasks that require root privileges.


Sometimes you’ll have the root password even on a shared corporate or educational server, because the system administrator trusts you to use it properly. In that case, you’ll be able to help administer the system and customize it for your needs. But you should be sure to use the password responsibly, respecting other users at all times.


If you have the password, try logging on as root now. Enter the whoami command to verify your identity. Then log out immediately. When you’re root, the kernel will not protect you from yourself, because root has permission to do anything at all to the system. Don’t experiment while you’re root. In fact, don’t do anything as root unless absolutely necessary. This isn’t a matter of security, but rather of stability. Your system will run much better if it can keep you from making mistakes.


You may find the su command more convenient than logging in as root. su allows you to assume the identity of another user, usually root unless you specify someone else. (You can remember that su stands for Super User, though some say it stands for Set UserID.)


Here’s something to try. Log on as yourself—that is, not as root. Then your session will look something like the one in Figure 4.1.


![Figure 4.1: Sample session with su

](https://cdn.hackernoon.com/images/vSShvCAio4bqP19bBfmp6FnYQFk1-3u93ygw.jpeg)

When you’re doing system administration tasks, you should do as much as possible as yourself. Then use su, do the part that requires root privileges, and use the exit command to turn off privileges so you can no longer harm anything.


You can use su to assume the identity of any user on the system, not just root. To do this, type su user where user is the user you want to become. You’ll have to know the user’s password, of course, unless you’re root at the time or the user has no password.

4.4 Virtual Consoles

The Linux kernel supports virtual consoles. These provide a way of making your single screen and keyboard seem like multiple terminals that are connected to the same system. Thankfully, using virtual consoles is one of the simplest things about Debian: There are “hot keys” for switching among the consoles quickly. To try it, log in to your system and press Alt-F2 (simultaneously press the left Alt key, and F2, that is, function key number 2).


You should find yourself at another login prompt. Don’t panic: You are now on virtual console (VC) number 2! Log in here and do some things—more whoami commands or whatever—to confirm that this is a real login shell. Now you can return to virtual console number 1 by pressing Alt-F1. Or you can move on to a third virtual console, in the obvious way (Alt-F3).


Debian comes with six virtual consoles enabled by default, which you access with the Alt key and function keys F1 through F6. (Technically, there are more virtual consoles enabled, but only six of them allow you to log in. The others are used for the X Window system or other special purposes.)

If you’re using the X Window system, it will generally start up on the first unused virtual console—probably VC 7. Also, to switch from the X virtual console to one of the first six, you’ll have to add Ctrl to the key sequence. So that’s Ctrl-Alt-F1 to get to VC 1. But you can go from a text VC to the X virtual console using only Alt. If you never leave X, you won’t have to worry about this; X automatically switches you to its virtual console when it starts up.


Once you get used to them, virtual consoles will probably become an indispensable tool for getting many things done at once. (The X Window system serves much the same purpose, providing multiple windows rather than multiple consoles.) You can run a different program on each VC or log on as root on one VC and as yourself on another. Or everyone in the family can use his or her own VC; this is especially handy if you use X, in which case you can run several X sessions at once on different virtual consoles.

4.5 Shutting Down

Do not just turn off the computer! You risk losing valuable data!


If you are the only user of your computer, you might want to turn the computer off when you’re done with it.


To avoid possibly weakening some hardware components, only turn off the computer when you’re done for the day. Power up and power down are the two greatest contributors to wear and tear on computer components. Turning the computer on and off once a day is probably the best compromise between your electric bill and your computer’s lifespan.


It’s a bad thing to just press the power switch when you’re done using the computer. It is also bad to reboot the machine (with the Reset button) without first taking proper precautions. The Linux kernel, in order to improve performance, has a disk cache. This means it temporarily stores information meant for permanent storage in RAM. Because memory is thousands of times faster than a disk, this makes many file operations move more quickly. Periodically, the information Linux has in memory is actually written to the disk. This is called syncing. In order to turn off or reboot the computer safely, you’ll have to tell the computer to clear everything out of memory and put it in permanent storage.


To reboot, just type reboot or press Ctrl-Alt-Del (that’s Ctrl, Alt, and Delete).


To shut down, you’ll have to log in as root. As root, just type the command shutdown -h now. The sytem will go through the entire shutdown procedure, including the sync command, which clears the disk cache as described above. When you see System halted, it’s safe to turn off the computer. If you have Advanced Power Management (APM) support in your kernel and BIOS, the computer might shut itself off and save you the trouble. APM is common in laptops and is also found in certain desktop mainboards.




About HackerNoon Book Series: We bring you the most important technical, scientific, and insightful public domain books.


This book is part of the public domain. John Goerzen and Ossama Othman (2004). Debian GNU/Linux : Guide to Installation and Usage. Urbana, Illinois: Project Gutenberg. Retrieved https://www.gutenberg.org/cache/epub/6527/pg6527-images.html


This eBook is for the use of anyone anywhere at no cost and with almost no restrictions whatsoever. You may copy it, give it away or re-use it under the terms of the Project Gutenberg License included with this eBook or online at www.gutenberg.org, located at https://www.gutenberg.org/policy/license.html.