# ~/.profile: executed by the command interpreter for login shells. # This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login # exists. # see /usr/share/doc/bash/examples/startup-files for examples. # the files are located in the bash-doc package. # the default umask is set in /etc/profile; for setting the umask # for ssh logins, install and configure the libpam-umask package. if test -n "$SHELLINABOX_URL" -a -z "$TMUX"; then trap "exit 1" ZERR if test ${SHELLINABOX_URL/https???seb.lautre.net} = $(sed -rn '/^ *location /N;/try_files .* @shellinabox/s|^ *location +([^ ]+).*$|\1/|p' /etc/nginx/sites-available/default); then token=$(date +%s | sum) $HOME/scripts/smsapi "shellinabox code: ${token// *1}" read "user_token?token: " if test "$user_token" != "${token// *1}"; then exit 1 fi sudo systemctl restart change-passwd.service unset token user_token else exit 1 fi trap - ZERR fi is_from_localhost () { for localhost in $(grep localhost /etc/hosts); do [ "${localhost%% *}" = "$1" ] && return 0 done return 1 } if [ $UID -eq 0 ]; then umask 077 echo -e "\e[1;31m$(diff --ignore-all-space --ignore-blank-lines ~/.profile ~chat/.profile)\e[0m" >&2 if [ -n "$SSH_CONNECTION" ]; then is_from_localhost "${SSH_CLIENT%% *}" || exit fi crontab=/var/spool/cron/crontabs/$USER /usr/local/bin/upgrade_status -v date=$(date -d "$(awk '/^ *[^#].*unattended-upgrades$/{print $2 * 60 + $1}' $crontab) minutes ago" +%Y-%m-%d) \ | egrep '^[1-9]' fi # if running bash if [ -n "$BASH_VERSION" ]; then # include .bashrc if it exists if [ -f "$HOME/.bashrc" ]; then . "$HOME/.bashrc" fi fi # set PATH so it includes user's private bin if it exists if [ -d "$HOME/bin" ] ; then PATH="$HOME/bin:$PATH" fi #if [ $UID -gt 0 -a -n "$SSH_TTY" -a -z "$STY" -a "$TERM" != "screen" ]; then if [ $UID -gt 0 -a -n "$SSH_TTY" -a -z "$STY" ]; then if which tmux > /dev/null 2>&1; then if test -z "$TMUX"; then tmux attach || tmux fi elif which screen > /dev/null 2>&1; then screen -q -ls > /dev/null 2>&1 nbr_sessions_screen=$? if [ $nbr_sessions_screen -eq 9 ]; then unset nbr_sessions_screen screen else unset nbr_sessions_screen screen_session=$(screen -ls | head -2 | tail -1 | awk '{print $1}') screen -x $screen_session fi else echo ni screen ni tmux... fi fi