Sponsored Content
Full Discussion: xsession for non-root user
Operating Systems AIX xsession for non-root user Post 302533734 by DGPickett on Friday 24th of June 2011 01:05:56 PM
Old 06-24-2011
I am confused. Which on which? Tell me now far you get on this sort of procedure:

In my life, for a virgin situation, I start the X server on the PC and then ssh over there and export $DISPLAY to point to me. Then I fire up an xterm. If you set $SHELL to your favorite, xterm -ls will use it. Then I do a window manager from that xterm and more xterm, xclipboard, etc.

I like a visual bell, big scroll buffer, nice icon and title labels, big windows 80x25 with big font, great for mentoring over my shoulder not to mention my fuzzy eyes.
Code:
$ cat bin/xth
#!/usr/bin/ksh
if [ "${1#[1-9])}" != "$1" ]
then
 zn=$1
 shift
else
 ps -fxu $USER | sed '
        s/.* xterm .* -n \([0-9]*\).*/\1/
        t
        d
        '|sort -nr|read zn
 zn=$(( $zn + 1 ))
fi
cd
export TERM=xterm
nohup xterm -T "${HOST}-$zn" -n $zn -geometry 80x25 -fn 12x24 -sb -sl 99999 -vb -bg white -fg black "$@" &
sleep 1
$

I also use ultravnc viewer and vnc Xvnc on each host, so no desktops, windows or keystrokes are lost if the PC must go away, and only one desktop if a server is rebooted. My $DISPLAY is always ':1.0' !
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Other than root user .Normal user is unable to create files

Hi all, I am using Sun Solaris 9 .In this system normal users unable to create files from the command line.I added these users in bin,adm and even root group i found them unable to create a file. (1 Reply)
Discussion started by: mallesh
1 Replies

2. Shell Programming and Scripting

root user command in shell script execute as normal user

Hi All I have written one shell script for GPRS route add is given below named GPRSRouteSet.sh URL="www.google.com" VBURL="10.5.2.211" echo "Setting route for $URL for GPRS" URL_Address=`nslookup $URL|grep Address:|grep -v "#"|awk -F " " '{print $2}'|head -1` echo "Executing ... (3 Replies)
Discussion started by: mnmonu
3 Replies

3. UNIX for Dummies Questions & Answers

How to allow access to some commands having root privleges to be run bu non root user

hi i am new to unix and i have abig task. i have to \run particular commands having root privileges from a non root user. i know sudo is one of the way but i need sum other approach kindly help Thanks (5 Replies)
Discussion started by: suryashikha
5 Replies

4. Solaris

java version mismatch for normal user and root user

:confused: I installed latest version of java ( jre 1.6) on Solaris Machine ......when I run java -version as root, shows the latest version but when I run java -version as normal user, shows the old / previous version What should I do to fix this ...should show the latest version... (3 Replies)
Discussion started by: frintocf
3 Replies

5. UNIX for Dummies Questions & Answers

Sudo to delegate permission from non-root user to another non-root user

I've been through many threads before i decide to create a separate thread. I can't really find the solution to my (simple) problem. Here's what I'm trying to achieve: As "canar" user I want to run a command, let's say "/opt/ocaml/bin/ocaml" as "duck" user. The only to achieve this is to... (1 Reply)
Discussion started by: canar
1 Replies

6. Shell Programming and Scripting

How to Login as another user through Shell script from current user[Not Root]

Hi Every body, I would need a shell script program to login as different user and perform some copy commands in the script. example: Supppose ora_toms is the active user ora_toms should be able to run a script where user: ftptomsp pass: XXX should login through and run the commands ... (9 Replies)
Discussion started by: ujjwal27
9 Replies

7. UNIX for Advanced & Expert Users

Root and non-root user not able to delete the file

Hi!! one strange problem occurred with my RHEL 5 box. i'm having logs folder with ownership of non-root user. Created some files with root user under logs folder. here is the scene: -rw-r----- 1 root root 1048227 Feb 28 12:34 SystemOut_13.02.28_12.34.10.log -rw-r----- 1 root root ... (6 Replies)
Discussion started by: sukhdip
6 Replies

8. Shell Programming and Scripting

How to give root access to non root user?

Currently in my system Red Hat is installed. And Many user connect to my machine via SSH Techia Terminal. I want to give some users a root level access. Can anyone please help me how to make it possible. I too searched on the Google but didn't find the correct way Regards ADI (4 Replies)
Discussion started by: adisky123
4 Replies

9. UNIX for Dummies Questions & Answers

Switching from root to normal user takes me to user's home dir

Whenever i switch from root to another user, by doing su - user, it takes me to home directory of user. This is very annoying as i want to be in same dir to run different commands as root sometimes and sometimes as normal user. How to fix this? (1 Reply)
Discussion started by: syncmaster
1 Replies

10. Shell Programming and Scripting

How to Switch from Local user to root user from a shell script?

Hi, I need to switch from local user to root user in a shell script. I need to make it automated so that it doesn't prompt for the root password. I heard the su command will do that work but it prompt for the password. and also can someone tell me whether su command spawns a new shell or... (1 Reply)
Discussion started by: Little
1 Replies
Xsession(5)							File Formats Manual						       Xsession(5)

NAME
Xsession - initialize X session SYNOPSIS
Xsession [ session-type ] DESCRIPTION
/etc/X11/Xsession is a Bourne shell (sh(1)) script which is run when an X Window System session is begun by startx(1) or a display manager such as xdm(1). (Some display managers only invoke Xsession when specifically directed to so by the user; see the documentation for your display manager to find out more.) Administrators unfamiliar with the Bourne shell will likely find the Xsession.options(5) configuration file easier to deal with than Xsession itself. Xsession is not intended to be invoked directly by the user; to be effective it needs to run in a special environment associated with X server initialization. startx, xdm, xinit(1), and other similar programs handle this. By default on a Debian system, Xsession is used by both common methods of starting the X Window System, xdm (or another X display manager) and startx. To change this for xdm, edit the 'DisplayManager*session' resource in the /etc/X11/xdm/xdm-config file -- for other display managers, consult their documentation. To stop startx from using Xsession by default, replace the contents of the /etc/X11/xinit/xinitrc file. The Xsession script is quite flexible, and extensive customization of the X startup procedure is possible without modifying the script itself. See "CUSTOMIZING THE STARTUP PROCEDURE" below. SESSION TYPES Xsession may optionally be passed a single argument indicating the type of X session to be started. It is up to the display manager to set the argument. To pass Xsession an argument from startx or xinit, /etc/X11/Xsession (or /etc/X11/xinit/xinitrc) must be called explicitly with a path, as in startx /etc/X11/Xsession failsafe. By default, three different arguments are supported: failsafe invokes a session consisting solely of an x-terminal-emulator(1) (no window manager is launched). If the x-terminal-emulator pro- gram cannot be found, the session exits. The 'failsafe' argument is ignored if there is no 'allow-failsafe' line in Xses- sion.options. default produces the same behavior as if no session type argument had been given at all. program starts program if it can be found in the $PATH. This is usually a session manager or a very featureful window manager. If program is not found, the Xsession script proceeds with its default behavior. This argument is ignored if there is no 'allow-user-xsession' line in Xsession.options. (If the administrator does not want users writing their own .xsession files, it makes little sense to permit them to specify the names of arbitrary programs to run.) Note that the restriction may be easy to bypass, e.g. by using a .gnomerc file instead. DEFAULT STARTUP PROCEDURE Initially, Xsession performs some housekeeping. It declares a set of built-in functions (see "BUILT-IN SHELL FUNCTIONS" below) and vari- ables, then attempts to create a log file for the X session, or append to an existing one. Historically this is called an 'error' file, but it catches all sorts of diagnostic output from various X clients run in the user's session, not just error messages. If it is impossi- ble to write to an error file, the script (and thus the X session) aborts. For convenience, once the error file is successfully opened, Xsession reports the fact that the session has started, the invoking username, and the date to the error file. This makes it easier to discern which X session produced a particular line of output in the file. Xsession next confirms that its script directory, Xsession.d, exists. If it does not, the script aborts. After the script directory is confirmed to be present, Xsession uses run-parts(1) to identify files in that directory that should be sourced (executed) in the shell's environment. Only files named in a certain way are sourced; see the run-parts manual page for a description of valid characters in the filename. (This restriction enables the administrator to move experimental or problematic files out of the way of the script but keep them in an obvious place, for instance by renaming them with '.old' or '.broken' appended to the filename.) SUPPLIED SCRIPTS Five shell script portions are supplied by default to handle the details of the session startup procedure. /etc/X11/Xsession.d/20x11-common_process-args Arguments are processed as described in "SESSION TYPES" above. The startup program, if one is identified at this point, is merely stored for later reference, and not immediately executed. /etc/X11/Xsession.d/30x11-common_xresources X resources are merged. run-parts is again used, this time to identify files in the /etc/X11/Xresources directory that should be processed with 'xrdb -merge'. Next, if the line 'allow-user-resources' is present in Xsession.options, the user's $HOME/.Xresources file is merged in the same way. /etc/X11/Xsession.d/35x11-common_xhost-local Give access to the X server to the same user on the local host. If the xhost command is available, it will use it to allow any process of the same user running on the local host to access the X server. /etc/X11/Xsession.d/40x11-common_xsessionrc Source global environment variables. This script will source anything in $HOME/.xsessionrc if the file is present. This allows the user to set global environment variables for their X session, such as locale information. /etc/X11/Xsession.d/50x11-common_determine-startup Determine startup program. The X client to launch as the controlling process (the one that, upon exiting, causes the X server to exit as well) is determined next. If a program or failsafe argument was given and is allowed (see above), it is used as the con- trolling process. Otherwise, if the line 'allow-user-xsession' is present in Xsession.options, a user-specified session program or script is used. In the latter case, two historically popular names for user X session scripts are searched for: $HOME/.xsession and $HOME/.Xsession (note the difference in case). The first one found is used. If the script is not executable, it is marked to be executed with the Bourne shell interpreter, sh. Finally, if none of the above succeeds, the following programs are searched for: /usr/bin/x-session-manager, /usr/bin/x-window-manager, and /usr/bin/x-terminal-emulator. The first one found is used. If none are found, Xsession aborts with an error. /etc/X11/Xsession.d/90x11-common_ssh-agent Start ssh-agent(1), if needed. If the line 'use-ssh-agent' is present in Xsession.options, and no SSH agent process appears to be running already, ssh-agent is marked to be used to execute the startup program determined previously. Note: this functionality may move to the ssh package in the future. /etc/X11/Xsession.d/99x11-common_start Start the X session. The startup program is executed, inside a Bourne shell if it is not executable, and inside an ssh-agent if necessary. The shell's exec command is used to spare a slot in the process table. CUSTOMIZING THE STARTUP PROCEDURE Of course, any of the existing files can be edited in place. Because the order in which the various scripts in /etc/X11/Xsession.d are executed is important, files to be added to this directory should have a well-formed name. The following format is recommended: * a two-digit number denoting sequence; * the name of the package providing the script (or 'custom' for locally-created scripts); * an underscore; * a description of the script's basic function, using only characters allowed by run-parts. Here is an example of how one might write a script, named 40custom_load-xmodmap, to invoke xmodmap(1): SYSMODMAP="/etc/X11/Xmodmap" USRMODMAP="$HOME/.Xmodmap" if [ -x /usr/bin/X11/xmodmap ]; then if [ -f "$SYSMODMAP" ]; then xmodmap "$SYSMODMAP" fi fi if [ -x /usr/bin/X11/xmodmap ]; then if [ -f "$USRMODMAP" ]; then xmodmap "$USRMODMAP" fi fi Those writing scripts for Xsession to execute should avail themselves of its built-in shell functions, described below. BUILT-IN SHELL FUNCTIONS message is used for communicating with the user. It is a wrapper for the echo(1) command and relies upon echo for its argument processing. This function may be given an arbitrarily long message string, which is formatted to the user's terminal width (breaking lines at white- space) and sent to standard error. If the DISPLAY environment variable is set and the xmessage(1) program is available, xmessage is also used to display the message. message_nonl is used for communicating with the user when a trailing newline is undesirable; it omits a trailing newline from the message text. It otherwise works as message. errormsg is used for indicating an error condition and aborting the script. It works as message, above, except that after displaying the message, it will exit Xsession with status 1. ENVIRONMENT
The following environment variables affect the execution of Xsession: HOME specifies the user's home directory; various files are searched for here. TMPDIR names a default directory for temporary files; if the standard X session error file cannot be opened, this variable is used to locate a place for one. COLUMNS indicates the width of terminal device in character cells. This value is used for formatting diagnostic messages. INPUT FILES
/etc/X11/Xsession.d/ is a directory containing Bourne shell scripts to be executed by Xsession. Files in this directory are matched using run-parts and are sourced, not executed in a subshell. /etc/X11/Xresources/ is a directory containing files corresponding to Debian package names, each of which contains system-wide X resource settings for X clients from the corresponding package. The settings are loaded with xrdb -merge. Files in this directory are matched using run-parts. /etc/X11/Xsession.options contains configuration options for the /etc/X11/Xsession script. See Xsession.options(5) for more information. $HOME/.Xresources contains X resources specific to the invoking user's environment. The settings are loaded with xrdb -merge. Note that $HOME/.Xde- faults is a relic from X Version 10 (and X11R1) days, before app-defaults files were implemented. It has been deprecated for over ten years at the time of this writing. .Xresources should be used instead. $HOME/.xsession is a sequence of commands invoking X clients (or a session manager such as xsm(1)). See the manual page for xinit for tips on writ- ing an .xsession file. OUTPUT FILES
$HOME/.xsession-errors is where standard output and standard error for Xsession script and all X client processes are directed by default. $TMPDIR/filename is where the X session error file is placed if $HOME/.xsession-errors cannot be opened. For security reasons, the exact filename is randomly generated by tempfile(1). AUTHORS
Stephen Early, Mark Eichin, and Branden Robinson developed Debian's X session handling scripts. Branden Robinson wrote this manual page. SEE ALSO
Xsession.options(5), X(7), run-parts(1), ssh-agent(1), startx(1), tempfile(1), xdm(1), xmessage(1), xmodmap(1), xrdb(1), sh(1) Debian Project 2004-11-04 Xsession(5)
All times are GMT -4. The time now is 12:13 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy