Archive:Getting Started/Run/Shell
Getting_Started/Run/Shell
Languages: عربي | Asturianu | Català | Česky | Kaszëbsczi | Dansk | Deutsch | English | Esperanto | Español | Eesti | فارسی | Suomi | Français | Galego | Italiano | 日本語 | 한국어 | Norwegian | Polski | Português Brasileiro | Română | Русский | Svenska | Slovenčina | Slovenščina | српски | Türkçe | Tiếng Việt | Українська | 简体中文 | 繁體中文
Using the normal shell with sux
For this method, the tool sux (http://fgouget.free.fr/sux/sux-readme.shtml) is required. sux is available on most distributions. Otherwise you could rely on the normal shell without sux method below. sux allows you to change to another user with an implicit managing of the X forwarding details (authentication and DISPLAY exporting) in a clean and simple way.
To login, type <syntaxhighlight lang="bash">sux - kde-devel
All environment variables and everything else should be set up correctly by your .bashrc. To start an application, simply type it's name; for example <syntaxhighlight lang="bash">kwrite
Using the normal shell without sux
The simplest method to launch KDE 4 applications is using su to login as the kde-devel user and then simply start any KDE 4 application from command line. To login, type <syntaxhighlight lang="bash">su - kde-devel and then, after entering your password <syntaxhighlight lang="bash">export DISPLAY=:0
All environment variables and everything else should be set up correctly by your .bashrc. To start an application, simply type it's name; for example <syntaxhighlight lang="bash">kwrite
- run <syntaxhighlight lang="bash">unset XDG_DATA_DIRS ; kbuildsycoca4
Using SSH
The simplest way to run a KDE 4 application with SSH in your current desktop environment is to get an X-aware shell prompt as the kde-devel user like this: <syntaxhighlight lang="bash">ssh -X kde-devel@localhost Now you can launch KDE apps as usual, for example: <syntaxhighlight lang="bash">kwrite The two lines can be conveniently combined: <syntaxhighlight lang="bash">ssh -X kde-devel@localhost kwrite
Passwordless login
Before anything serious can be done using this method, a passwordless login needs to be set up. To start, run the following command as the regular desktop user: <syntaxhighlight lang="bash">ssh-keygen -t rsa Hit enter three times to accept the path of ~/.ssh/id_rsa and an empty passphrase. Now, copy the single line in ~/.ssh/id_rsa.pub that's printed after running this command: <syntaxhighlight lang="bash">cat ~/.ssh/id_rsa.pub After that line is copied, ssh back into the kde-devel user and put the copied line in the file $HOME/.ssh/authorized_keys: <syntaxhighlight lang="bash">ssh -X kde-devel@localhost $HOME/kde/bin/kwrite \
$HOME/.ssh/authorized_keys
Paste in the line, save the file, and quit KWrite.
Next make sure $HOME/.ssh/authorized_keys has the correct permissions: <syntaxhighlight lang="bash">ssh kde-devel@localhost chmod og-xrw ~kde-devel/.ssh/authorized_keys Now try running KWrite again with the same SSH command; you shouldn't have to enter a password anymore: <syntaxhighlight lang="bash">ssh -X kde-devel@localhost $HOME/kde/bin/kwrite
The SSH desktop file
If you want to be able to launch apps more easily than running them with an SSH command from the command line, one way is to create .desktop files that ssh into the other account.
You can start with an existing .desktop file as a template (like one from your desktop) or you can make one from scratch. The main idea is to prefix the command being run with this string:
<syntaxhighlight lang="bash">
ssh -X kde-devel@localhost $HOME/kde/bin/
A simple .desktop file that runs KWrite would have the following contents:
<syntaxhighlight lang="ini"> [Desktop Entry] Categories=Qt;KDE;TextEditor; Comment= DocPath=kwrite/index.html Encoding=UTF-8 Exec=ssh -X kde-devel@localhost /home/kde-devel/kde/bin/kwrite %U GenericName=Text Editor Icon=kwrite InitialPreference=8 MimeType=text/plain Name=KWrite (kde-devel) Path= StartupNotify=false Terminal=false TerminalOptions= Type=Application X-DBUS-StartupType=Multi X-DCOP-ServiceType=non X-KDE-StartupNotify=true X-KDE-SubstituteUID=false X-KDE-Username=