WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Preventing user to switch to CLI (consoul/shell) from GUI.  (Read 8803 times)

Offline ipmeel

  • Jr. Member
  • **
  • Posts: 59
Preventing user to switch to CLI (consoul/shell) from GUI.
« on: October 03, 2016, 04:39:10 AM »
Is it possible to prevent use to switch to CLI (consoul/shell) from GUI?
How to disable "CTL+ALT+Backspace" and "CTL+ALT+F1", that kills GUI?
How to disable or remove "Exit to Prompt" option in "TC Exit Options" (see attached image)?

Offline ipmeel

  • Jr. Member
  • **
  • Posts: 59
Re: Preventing user to switch to CLI (consoul/shell) from GUI.
« Reply #1 on: October 07, 2016, 02:28:42 AM »
Customised 'exittc': removed 'Exit to Prompt' option (see attached image).
On ubuntu system, installed FLTK library and dependencies.
downloaded 'exittc.fl' file from https://github.com/tinycorelinux/fltk_projects/blob/master/exittc/exittc.fl.
Compiled ‘exittc.fl’ with following command, it created 2 files ('exittc.cxx', 'exittc.h')
Code: [Select]
fluid -c exittc.flExecuted following command to create 'exittc' (an executable file)..
Code: [Select]
fltk-config --compile exittc.cxxReplaced the existing 'exittc' file with new one (Location: "TinyCore.iso>cde>optional>Xprogs.tcz>usr>local>bin>exittc")
It is working file, now there is no option for 'Exit to Prompt'.

The only issue is that size of new file is about 500KiB, but the size of original was just about 8KiB!!! (any recommendations)
« Last Edit: October 07, 2016, 02:33:06 AM by ipmeel »

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14754
Re: Preventing user to switch to CLI (consoul/shell) from GUI.
« Reply #2 on: October 07, 2016, 03:08:09 AM »
You could use the Makefile in git to ensure exittc is compiled with the tinycore cxxflags and dynamically linked.

..and compile it on tinycore

Edit: alternatively:
Code: [Select]
$ g++ -flto -fuse-linker-plugin -march=i486 -mtune=i686 -Os -pipe -fno-exceptions -fno-rtti -fpic -lfltk -o exittc exittc.cxx
« Last Edit: October 07, 2016, 03:20:42 AM by Juanito »

Offline ipmeel

  • Jr. Member
  • **
  • Posts: 59
Re: Preventing user to switch to CLI (consoul/shell) from GUI.
« Reply #3 on: October 07, 2016, 05:37:21 AM »
Hi Juanito,
Thank you for the suggestions.
I don't have  much experience with Linux and C++.
May I ask if you could make it from attached files.
Kind regards.

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14754
Re: Preventing user to switch to CLI (consoul/shell) from GUI.
« Reply #4 on: October 07, 2016, 07:09:19 AM »
see attached.

You can achieve the same thing yourself with:
Code: [Select]
$ tce-load -i compiletc fltk-1.3-dev sstrip

$ cd exittc

$ g++ -flto -fuse-linker-plugin -march=i486 -mtune=i686 -Os -pipe -fno-exceptions -fno-rtti -fpic -lfltk -o exittc exittc.cxx

$ sstrip exittc

Offline nitram

  • Hero Member
  • *****
  • Posts: 1054
Re: Preventing user to switch to CLI (consoul/shell) from GUI.
« Reply #5 on: October 07, 2016, 07:43:33 AM »
Is it possible to prevent use to switch to CLI (consoul/shell) from GUI?
How to disable "CTL+ALT+Backspace" and "CTL+ALT+F1", that kills GUI?
How to disable or remove "Exit to Prompt" option in "TC Exit Options" (see attached image)?

Hi ipmeel. Just curious why? You are going through a lot of effort, so i'm thinking security related? If so modifying exittc to block TTY access will not suffice. A user with virtual terminal access can run  killall Xorg  and it will return to TTY. System Tools -> Run Program accepts the  killall Xorg  command. Running  sudo openvt  creates an additional TTY on the fly as root, so sudo should be password protected. Physical access to the machine or power supply may allow reboot, so the boot manager (text bootcode) and Tiny Core user login should be password protected. Didn't test CTL+ALT+Backspace and CTL+ALT+F1 so i could finish this post, may be Window Manager dependent. Regardless, ensure the Window Manager does not have additional keyboard shortcuts to exit, open terminal, etc. Probably other methods, fun to brainstorm. If the purpose of your  exittc  modification is not security related please ignore this post.

Offline ipmeel

  • Jr. Member
  • **
  • Posts: 59
Re: Preventing user to switch to CLI (consoul/shell) from GUI.
« Reply #6 on: October 07, 2016, 10:32:16 AM »
@Juanito,
Many-many thanks, it worked like charm.
---
@nitram,
Our users don't have physical access to systems.
All icons are excluded from wBar, except 'Exit' and 'Remote Desktop Connection'. The mouse click-context-menu is also disabled. Now 'TC Exit option' is modified. I think there are only remaining possibilities to access 'terminal' or TTY is using 'CTL+ALT+Backspace' and 'CTL+ALT+F1'.
I am not familiar with window manager, I will explore it.
Thanks for your comments.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11514
Re: Preventing user to switch to CLI (consoul/shell) from GUI.
« Reply #7 on: October 07, 2016, 10:39:40 AM »
Hi ipmeel
To disable  CTL+ALT+F1  try commenting out the  tty1  line in  /etc/inittab. This would need to be done in the  initrd
file (rootfs.gz).
For  CTL+ALT+Backspace, try Googling  linux nozap.

Offline nitram

  • Hero Member
  • *****
  • Posts: 1054
Re: Preventing user to switch to CLI (consoul/shell) from GUI.
« Reply #8 on: October 07, 2016, 11:53:01 AM »
Alt-SysRq REISUB is also enabled by default, entering  Alt-SysRq+R+ E  will get TTY:
https://en.wikipedia.org/wiki/Magic_SysRq_key
/proc/sys/kernel/sysrq

Offline ipmeel

  • Jr. Member
  • **
  • Posts: 59
Re: Preventing user to switch to CLI (consoul/shell) from GUI.
« Reply #9 on: October 07, 2016, 01:45:11 PM »
Hi Rich,
I commented out the tty1 line in 'tinycore-current.iso>/boot/>core.gz>/etc/inittab'.
But, while booting from ISO file, the boot screen hangs at 'Setting hostname to Box Done'.

I try to extract and packed 'core.gz' by two methods...
(1) using 'core-remaster.tcz' and
(2) by following steps mentioned at http://wiki.tinycorelinux.net/wiki:remastering.


Offline ipmeel

  • Jr. Member
  • **
  • Posts: 59
Re: Preventing user to switch to CLI (consoul/shell) from GUI.
« Reply #10 on: October 09, 2016, 10:21:30 AM »
Resolved!!!
(1) Installed 'Xorg-7.X.tcz' and removed 'Xvesa.tcz' from 'onboot.lst'. It disabled 'CTRL+ALT+Backspace', don't know how?
(2) Put a file ‘xorg.conf’ in ‘Xorg-7.7-bin.tcz’>/etc/X11/ with following content...
Code: [Select]
Section “ServerFlags”
  Option “DontVTSwitch” “yes”
  Option “DontZap” “yes”
EndSection
It disabled  'CTRL+ALT+Fn'.

Offline Misalf

  • Hero Member
  • *****
  • Posts: 1702
Re: Preventing user to switch to CLI (consoul/shell) from GUI.
« Reply #11 on: October 09, 2016, 01:43:18 PM »
Quote
It disabled 'CTRL+ALT+Backspace', don't know how?
For Xorg, it would need
Code: [Select]
Section "InputClass"
Option           "XkbOptions"  "terminate:ctrl_alt_bksp"
EndSection

Download a copy and keep it handy: Core book ;)

Offline ipmeel

  • Jr. Member
  • **
  • Posts: 59
Re: Preventing user to switch to CLI (consoul/shell) from GUI.
« Reply #12 on: October 09, 2016, 08:47:22 PM »
Code: [Select]
Section "InputClass"
Option           "XkbOptions"  "terminate:ctrl_alt_bksp"
EndSection
Is it should be in ‘xorg.conf’ ?