Linux - SecurityThis forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I've noticed that if I start fluxbox with startx I can still kill the xserver with CTRL_ALT_BSP if the screen is locked, so basically everyone who knows this has access to my user account and can start graphically again.
Now preferably I don;t want to use a graphical login manager but it seems to me it's the only way to secure this or is there another way?
Originally posted by mirradric One trick that I used...
i made startx an alias to startx & exit
so i'll be logged out of the console once x starts. Even if some1 zaps X, he'll end up at a login prompt.
This is what I want to do I still want to use those key combinations myself.
But how do I add that in an alias. When I just start with "startx && exit" it works but when I have "startx="startx; exit"" or "startx="startx & exit"" or "startx="startx&&exit"" as alias in my ~/.bashrc or ~/.local_bashrc it doesn't work
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything:
[ -z "$PS1" ] && return
# don't put duplicate lines in the history. See bash(1) for more options
#export HISTCONTROL=ignoredups
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
#shopt -s checkwinsize
# enable color support of ls and also add handy aliases
if [ "$TERM" != "dumb" ]; then
eval `dircolors -b`
alias ls='ls --color=auto'
#alias dir='ls --color=auto --format=vertical'
#alias vdir='ls --color=auto --format=long'
fi
# some more ls aliases
#alias ll='ls -l'
#alias la='ls -A'
#alias l='ls -CF'
alias startx='startx && exit'
# set variable identifying the chroot you work in (used in the prompt below)
#if [ -z "$debian_chroot" -a -r /etc/debian_chroot ]; then
# debian_chroot=$(cat /etc/debian_chroot)
#fi
# set a fancy prompt (non-color)
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
# Comment in the above and uncomment this below for a color prompt
#PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
# If this is an xterm set the title to user@host:dir
case $TERM in
xterm*|rxvt*)
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"'
;;
*)
;;
esac
# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc).
#if [ -f /etc/bash_completion ]; then
# . /etc/bash_completion
#fi
actually yeah that's better i'd say, as the single & just forks and then logs out. whereas the && only exits after a successful quit of X... and thinking about it, zapping X might even return an error code, meaning exit won't even run... so ignore me, and use mirradric's version.
I think I found the problem. If I made the alias different than startx so for example just x it would give unknown command. Now if I do this:
Code:
bash
x
The alias is recognised but it sort of locks when I kill the xserver with CTRL-ALT-BSP, and I have to CTRL-C out. After the CTRL-C it doesn't recognize the command anymore. Could it be that I'm running a different shell than bash and how would I find this out, and make the alias work?
Originally posted by darkleaf I think I found the problem. If I made the alias different than startx so for example just x it would give unknown command. Now if I do this:
Code:
bash
x
The alias is recognised but it sort of locks when I kill the xserver with CTRL-ALT-BSP, and I have to CTRL-C out. After the CTRL-C it doesn't recognize the command anymore. Could it be that I'm running a different shell than bash and how would I find this out, and make the alias work?
are you first running bash then running the alias?
If this is the case, you'll not get a login prompt but just exit from the bash instance you've just created. (dropping you to your previous shell) This is not what you want.
Originally posted by mirradric are you first running bash then running the alias?
If this is the case, you'll not get a login prompt but just exit from the bash instance you've just created. (dropping you to your previous shell) This is not what you want.
Yes that's what happening but if I don't run bash the alias isn't recognized. echo $SHELL gives me /bin/bash so that's ok. Any ideas on why it doesn't work?
try echo $0 before you run bash.
As I mention $SHELL seems to always contain /bin/bash. I suspect not all shells will set this variable so we can't depenent on it.
echo $0 **should** return the name of the command used to start the shell.
ps. maybe you can try adding the alias to your ~/.bash_profile instead
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.