diff --git a/Userland/Utilities/CMakeLists.txt b/Userland/Utilities/CMakeLists.txt index 634f4832e8b..6f04ebb49df 100644 --- a/Userland/Utilities/CMakeLists.txt +++ b/Userland/Utilities/CMakeLists.txt @@ -165,6 +165,7 @@ target_link_libraries(mount LibMain) target_link_libraries(nc LibMain) target_link_libraries(netstat LibMain) target_link_libraries(nl LibMain) +target_link_libraries(nologin LibMain) target_link_libraries(notify LibGUI LibMain) target_link_libraries(nproc LibMain) target_link_libraries(ntpquery LibMain) diff --git a/Userland/Utilities/nologin.cpp b/Userland/Utilities/nologin.cpp new file mode 100644 index 00000000000..9e58726712b --- /dev/null +++ b/Userland/Utilities/nologin.cpp @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2022, Beckett Normington + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#include +#include +#include + +ErrorOr serenity_main(Main::Arguments) +{ + TRY(Core::System::pledge("stdio rpath"sv)); + + auto file_or_error = Core::Stream::File::open("/etc/nologin"sv, Core::Stream::OpenMode::Read); + if (file_or_error.is_error()) { + outln("This account is currently not available."sv); + } else { + auto message_from_file = TRY(file_or_error.value()->read_all()); + out(message_from_file); + } + + return 1; +}