FreeBSD System Login and exit

Source: Internet
Author: User
Tags exit time interval

After the system finishes executing the RC startup script, FreeBSD will read the/etc/ttys file, start multiple virtual consoles as configured, and start the logon process login on the console to accept user logins. Users can switch between different consoles using function keys such as ALT-F1, Alt-f2, and ALT-F3. By default, there are 4 virtual consoles (where the fourth does not provide a logon service), up to 12 virtual consoles (limited by the 12 functional keys of a standard PC).

The system prints a login prompt on the console, at which point the root user and the root password set at installation can be used to log on to the system.

Freebsd/i386 wb.online.ha.cn (ttyv0)

Login:root

Password:

After the user has authenticated the password, the system displays the contents of the/ETC/MOTD to the screen, which usually places the notification content that the system administrator wants to notify each user, thus informing the user who is logged in about the information. The login program then launches the user's login shell, and the login shell executes/etc/profile to set up the user environment.

When you log on to the system, users can enter various commands to use the FreeBSD system to handle each task.

When the work is complete, you can use the logout command to exit the current session. Using exit, or using key ctrl-d (^d), you can end the current session and exit the logon process.

# Logout

Shutting down the system
Because FreeBSD is a multitasking system with multiple processes running and disk buffering technology used to provide better system efficiency, shutting down the computer by using the direct power off method can cause damage to the system. During the restart process after an abnormal shutdown, the system detects and repairs the hard drive error by detecting the last time the system was improperly shut down and automatically running the hard drive checker fsck (launched by the RC file).

Shutdown needs to be logged into the system as root, using the shutdown command to shut down the system, you need to use the-H parameter, indicating halt, downtime operation:

# shutdown-h Now

FEB 4 12:18:26 WB Shutdown:halt by Root:

FEB 4 12:18:29 WB syslogd:exiting on Signal 15

Syncing disks ... done

The operating system has halted.

Please press any key to reboot.

In some cases, if the system kernel is updated, reboot the system. You should use the-r parameter to indicate reboot and reboot the system:

# Shutdown-r Now

If you do not use the-H or-r parameter, the shutdown command attempts to enter Single-user state, which is slightly different from entering the boot-s command into single-user mode at boot loader, as multiple processes are running in the system because of multiple user status. When entering a single-user state, some processes may not exit gracefully, and the file system is in a different state.

And the argument now is a time parameter, and "Today" indicates that the shutdown operation is performed immediately. Since FreeBSD is a multiuser system, there are other users who use the system over the network when performing shutdown, which should normally delay one end of the time and perform the shutdown operation, giving the users who are connected a certain amount of time to save the data and exit the system. You need to use a different time parameter to start the shutdown. For example, the following command will cause the system to stop after 2 minutes, and will also send broadcast information to the logged-on user, informing the individual users who are currently logged on the information in the subsequent parameters:

# shutdown-h +2 "Hi guys! Please logout "

In addition to this increment form, the time parameter can also be expressed in absolute form without the "+" number, then the time parameter is HHMM format, such as 0120 means 1:20.

During the time interval when the system has not been shut down or shutdown, the/etc/nologin file will be generated, and the login program in the system will check the existence of the file and prevent the non-root user from logging on to the system when it is found. This file is deleted normally when shutdown performs a real shutdown or reboot, and if the file has not been deleted for some reason, the system login process will not allow normal users to log on.

The commands for immediate start and stop are also reboot and halt, equivalent to the shutdown instruction using the-R or-h parameter. Because this is a command to execute immediately, there is no function to warn the logged-on user. Because the command is relatively simple, it can be easily used in a single system.

If the user does not log in to the system using root, but is able to access the console, it can still be shut down without damaging the system. The user can use the Ctrl-alt-del hotkey to restart the computer, and then power down the computer when the computer enters the BIOS self-test. This method is no longer valid after the system has shielded the Ctrl-alt-del hotkey's startup capability.

Use "Options Sc_disable_reboot" when customizing the kernel to shield the system console from hot boot.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.