Announcement

Collapse
No announcement yet.

Copying .bashrc changes nothing?

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [SOLVED] Copying .bashrc changes nothing?

    My transition from Mepis 11 to Kubuntu 14.04 ongoing, I'm trying to make my Konsole windows look the way I'm used to. In Mepis, my prompt is white when I'm ordinary user, and changes to red when I become root with su (a subtle, non-distracting reminder that I'm in "hose yourself with a wrong keystroke" mode). Knowing (or thinking I knew) that this is a setting controlled by the .bashrc file in the user folder, I copied that file from my Mepis home folder to the corresponding location in the Kubuntu install. No change. I looked inside the file, and uncommented the line that the comments said to release to allow a color prompt. Now I have color; the user@system part of the prompt is green and the current directory portion is bluish -- but both change to plain white when I become root (I've activate the root account password and made it the default for kdesu and sudo, again making Kubuntu work the way I'm used to from Mepis). There has to be another file that controls how the prompt changes when my privilege changes -- where is it?

    #2
    .bashrc in / maybe?

    Comment


      #3
      Short answer, "/root/.bashrc".

      The bash prompt is controlled by the PS1 shell variable, which is typically set in your .bashrc, but can be set where you like. It can contain other shell expressions, including the $( ) construct which can be used to run arbitrary commands. I use it to run a shell function which outputs a trimmed version of the current directory.

      If I run sudo -i, the .bashrc in /root is sourced, but I long ago trampled all over that. I prefer using sudoedit or prefixing with sudo, or root actions in dolphin these days.
      Regards, John Little

      Comment


        #4
        edit the /root/.bashrc file and add in the following, preferably commenting out the existing lines that set the color, though you can simply add this line to the end of the file.

        Code:
          PS1='${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
        Once you've added this line, anytime you switch to using the root shell you will see the prompt in red with white text for the command line.

        One thing to remember KDE in Mepis 11 never worked 100%, and a lot of the commands used are out of date, a good example is the command used to open Dolphin as root, "kdesu dolphin" while it may work some of the time it will not work all the time,

        use
        Code:
        kdesu debus-launch dolphin
        and it will work as it should.

        Click image for larger version

Name:	konsole.jpg
Views:	1
Size:	71.9 KB
ID:	642350

        Comment


          #5
          Originally posted by Danum View Post
          ...
          use
          Code:
          kdesu debus-launch dolphin
          and it will work as it should.

          [ATTACH=CONFIG]5115[/ATTACH]
          That command never worked for me:
          Code:
          
          $ [console]kdesu debus-launch dolphin[/console]
          [I]kdesu: command not found[/I]
          
          $ [console]kdesudo debus-launch dolphin[/console]
          [I]Bus::open: Can not get ibus-daemon's address. 
          IBusInputContext::createInputContext: no connection to ibus-daemon [/I]
          
          $ [console]kdesudo dolphin[/console]
          [I]Connecting to deprecated signal QDBusConnectionInterface::serviceOwnerChanged(QString,QString,QString)
          QDBusConnection: session D-Bus connection created before QCoreApplication. Application may misbehave.
          QDBusConnection: session D-Bus connection created before QCoreApplication. Application may misbehave.
          kbuildsycoca4 running...
          Object::connect: No such signal org::freedesktop::UPower::DeviceAdded(QDBusObjectPath)
          Object::connect: No such signal org::freedesktop::UPower::DeviceRemoved(QDBusObjectPath)
          QInotifyFileSystemWatcherEngine::addPaths: inotify_add_watch failed: No such file or directory
          QFileSystemWatcher: failed to add paths: /root/.config/ibus/bus
          Bus::open: Can not get ibus-daemon's address. 
          IBusInputContext::createInputContext: no connection to ibus-daemon 
          QDBusConnection: session D-Bus connection created before QCoreApplication. Application may misbehave.
          QDBusConnection: session D-Bus connection created before QCoreApplication. Application may misbehave.
          QObject::connect: Cannot connect (null)::resourceScoreUpdated(QString, QString, QString, double) to NepomukPlugin::resourceScoreUpdated(QString, QString, QString, double)
          QObject::connect: Cannot connect (null)::recentStatsDeleted(QString, int, QString) to NepomukPlugin::deleteRecentStats(QString, int, QString)
          QObject::connect: Cannot connect (null)::earlierStatsDeleted(QString, int) to NepomukPlugin::deleteEarlierStats(QString, int)
          kactivitymanagerd(4691)/nepomuk (library): Could not find virtuoso to connect to. Aborting 
          QInotifyFileSystemWatcherEngine::addPaths: inotify_add_watch failed: No such file or directory
          QFileSystemWatcher: failed to add paths: /root/.kde/share/config/activitymanager-pluginsrc
          QPixmap::scaled: Pixmap is a null pixmap
          Object::connect: No such signal org::freedesktop::UPower::DeviceAdded(QDBusObjectPath)
          Object::connect: No such signal org::freedesktop::UPower::DeviceRemoved(QDBusObjectPath)
          [/I]
          And, Dolphin displays and runs normally.
          "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
          – John F. Kennedy, February 26, 1962.

          Comment


            #6
            Originally posted by Danum View Post
            edit the /root/.bashrc file and add in the following, preferably commenting out the existing lines that set the color, though you can simply add this line to the end of the file.

            Code:
              PS1='${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
            Once you've added this line, anytime you switch to using the root shell you will see the prompt in red with white text for the command line.
            What I'm actually looking for is black background and red text, but I think I can get there from this information. Edit: Oh, I see, that's what you gave, but the color goes back to default white text after the prompt is written to the terminal. That's perfect.

            One thing to remember KDE in Mepis 11 never worked 100%, and a lot of the commands used are out of date, a good example is the command used to open Dolphin as root, "kdesu dolphin" while it may work some of the time it will not work all the time,

            use
            Code:
            kdesu debus-launch dolphin
            and it will work as it should.

            [ATTACH=CONFIG]5115[/ATTACH]
            I found, after activating the root password and setting "Defaults=rootpw" in a file in /etc/sudoers.d, that most programs that should run with root privilege do so without editing the command line, and correctly ask for my root password. The only place I've added kdesu to the command is to create a launcher for "Dolphin as su" -- which I'll update as you suggest, next time I'm booted in Kubuntu.

            Comment


              #7
              Hmm. I, also, find that kdesu debus-launch dolphin fails to launch the file manager from the icon, and when entered at a command line results in
              Code:
               kdesu debus-launch dolphin
              kdesu: command not found
              On the other hand, kdesudo debus-launch dolphin gives
              Code:
               kdesudo debus-launch dolphin
              Bus::open: Can not get ibus-daemon's address. 
              IBusInputContext::createInputContext: no connection to ibus-daemon 
              
               kdesudo debus-launch dolphin
              Bus::open: Can not get ibus-daemon's address. 
              IBusInputContext::createInputContext: no connection to ibus-daemon
              But kdesu dolphin (and the other stuff that was after in the default menu launcher) hasn't failed to launch Dolphin correctly since I've had Kubuntu running, and after activating root password and authentication works with the root password. The only things I've found so far that still demand my user password (presumably because they're using policykit instead of kdesu or equivalent) are the various modules in System Settings. I can easily live with that, if there isn't a reasonably simple way to change policykit to require the root password for those functions.

              Comment


                #8
                Originally posted by Danum View Post
                One thing to remember KDE in Mepis 11 never worked 100%, and a lot of the commands used are out of date, a good example is the command used to open Dolphin as root, "kdesu dolphin" while it may work some of the time it will not work all the time, use
                Code:
                kdesu debus-launch dolphin
                and it will work as it should.
                Originally posted by GreyGeek View Post
                That command never worked for me:
                [CODE]$ kdesu debus-launch dolphin
                kdesu: command not found

                $ kdesudo debus-launch dolphin
                Bus:pen: Can not get ibus-daemon's address.
                IBusInputContext::createInputContext: no connection to ibus-daemon
                Once upon a time, kdesu was just a symlink to kdesudo. That was removed some time ago and we have only kdesudo now.

                Also, the D-Bus invocation is wrong. It should be dbus-launch -- no "e" in "dbus".

                Finally, the problems in older versions of KDE that required spawning new D-Bus daemons for elevating programs to root have been solved. It should no longer be necessary to do this. kdesudo dolphin is sufficient.

                Comment


                  #9
                  Originally posted by Silent Observer View Post
                  Hmm. I, also, find that kdesu debus-launch dolphin fails to launch the file manager from the icon, and when entered at a command line results in
                  Code:
                   kdesu debus-launch dolphin
                  kdesu: command not found
                  On the other hand, kdesudo debus-launch dolphin gives
                  Code:
                   kdesudo debus-launch dolphin
                  Bus::open: Can not get ibus-daemon's address. 
                  IBusInputContext::createInputContext: no connection to ibus-daemon 
                  
                   kdesudo debus-launch dolphin
                  Bus::open: Can not get ibus-daemon's address. 
                  IBusInputContext::createInputContext: no connection to ibus-daemon
                  But kdesu dolphin (and the other stuff that was after in the default menu launcher) hasn't failed to launch Dolphin correctly since I've had Kubuntu running, and after activating root password and authentication works with the root password. The only things I've found so far that still demand my user password (presumably because they're using policykit instead of kdesu or equivalent) are the various modules in System Settings. I can easily live with that, if there isn't a reasonably simple way to change policykit to require the root password for those functions.
                  Why are you trying to start Dolphin as root from Konsole, you should be starting it by using Krunner, ( Alt + F2, or by right clicking on the desktop and selecting "Run Command" ) entering "kdesu dbus-launch dolphin" then you will get a dialog asking for your root password
                  If you want to run Dolphin as root from Konsole, use the correct commands, in your case enter "su" give the root passwd which will give you a root konsole, then enter "dbus-launch dolphin" and Dolphin will open as root.
                  What I said about using "kdesu dolphin" was not that it will not open because it will, but, there are some apps that will not function correctly all the time when called using root (kdesu dolphin) namely Kate among others, but by using the correct command "kdesu dbus-launch" dolphin you get no problems, and it has been that way since KDE 4.8. you can look over at the KDE forums there are a lot of threads about it, plus there is one here on the Kubuntu forum.

                  Below is the dialog you get, the only difference you will have is at the top of the dialog you will have sudo not su as I have, but you still enter the root password,
                  One thing I would advise you to do is to make the colors of Dolphin different when you open it as root, then there are no mix ups and know exactly what you have open.
                  As user, System settings > Appearance > Colors, Get new Schemes > Search for kde4 seasons colors and install, then select Summer, which will give you a blue theme when you open Dolphin as user.
                  Using Krunner open System Settings as root, "kdesu dbus-launch systemsettings"
                  Appearance > Colors, Get new Schemes > Search for kde4 seasons colors and install, then select Autumm, which will give you a different theme when you open Dolphin as root.



                  Click image for larger version

Name:	root.jpg
Views:	1
Size:	73.6 KB
ID:	642354 Click image for larger version

Name:	dolphin-colors.jpg
Views:	1
Size:	63.2 KB
ID:	642355
                  Last edited by Danum; Jul 28, 2014, 02:50 AM.

                  Comment


                    #10
                    Originally posted by Danum View Post
                    Why are you trying to start Dolphin as root from Konsole, you should be starting it by using Krunner, ( Alt + F2, or by right clicking on the desktop and selecting "Run Command" ) entering "kdesu dbus-launch dolphin" then you will get a dialog asking for your root password
                    Some people may prefer to run from konsole, to take advantage of Ctrl+r, for example. kdesudo will work in both konsole and krunner, but kdesu only works in krunner, as the kdesu executable is commonly not in your $PATH. kdesudo dolphin (or kdesudo dbus-launch dolphin, if one prefers) will work regardless of your method of starting, and sudo/kdesudo can be configured to ask for root password instead of user's password.

                    Originally posted by Danum View Post
                    What I said about using "kdesu dolphin" was not that it will not open because it will, but, there are some apps that will not function correctly all the time when called using root (kdesu dolphin) namely Kate among others, but by using the correct command "kdesu dbus-launch" dolphin you get no problems, and it has been that way since KDE 4.8. you can look over at the KDE forums there are a lot of threads about it, plus there is one here on the Kubuntu forum.
                    True, running dolphin as root without 'dbus-launch' will only work the first time after a reboot, it'll start subsequent times as well, but launching some external applications like kate won't work. However, using dbus-launch will start a new dbus daemon for root every time it is used, so if you reboot seldomly, you can have hundreds of them running eventually. So I'd recommend using dbus-launch only when absolutely necessary.

                    Originally posted by Danum View Post
                    One thing I would advise you to do is to make the colors of Dolphin different when you open it as root, then there are no mix ups and know exactly what you have open.
                    As user, System settings > Appearance > Colors, Get new Schemes > Search for kde4 seasons colors and install, then select Summer, which will give you a blue theme when you open Dolphin as user.
                    Using Krunner open System Settings as root, "kdesu dbus-launch systemsettings"
                    Using a different color scheme is a good idea, but systemsettings will run just fine without dbus-launch, "kdesudo systemsettings" will do just fine without any adverse effects.

                    Comment


                      #11
                      Originally posted by Danum View Post
                      Why are you trying to start Dolphin as root from Konsole
                      I'm not, other than checking that the command has the correct syntax by using a method where I can see error messages. Once I know the command is working correctly and the launcher is accepting root password, I put that syntax into the icon properties and launch the GUI way, with a different icon image to keep Dolphin and "Dolphin as su" straight. This is part of restoring the root privilege and password operation I'm used to using, i.e. customizing my Linux distro to work the way I want it to -- one of the best reasons to use Linux (right behind the cost of upgrading Windows every couple years, and the fact that current, safe-to-use versions of Windows won't run on my older machines). Next is finding a way to get polkit to launch admin privilege as root user and require root password (at present, only System Settings and its children seem to be using polkit authentication).

                      I'll check the correct "kdesudo dbus-launch dolphin" syntax, and if that works, it'll solve the problem I had with Kate failing to launch from Dophin as su (which I had solved by installing and setting as default text editor the Kwrite -- which appears to be an alias for Kate with some command line options -- that I'm used to using anyway; like Dolphin, it launches repeatedly direct from kdesu/kdesudo without problems). And yes, a quick test shows that using the correct dbus-launch syntax gives a Dolphin as su that can successully launch Kate multiple times.

                      Comment


                        #12
                        Originally posted by Danum View Post
                        One thing I would advise you to do is to make the colors of Dolphin different when you open it as root, then there are no mix ups and know exactly what you have open.
                        As user, System settings > Appearance > Colors, Get new Schemes > Search for kde4 seasons colors and install, then select Summer, which will give you a blue theme when you open Dolphin as user.
                        Using Krunner open System Settings as root, "kdesu dbus-launch systemsettings"
                        Appearance > Colors, Get new Schemes > Search for kde4 seasons colors and install, then select Autumm, which will give you a different theme when you open Dolphin as root.
                        Aaah, nice. I'm not sure Autumn is what I'm after, but now I know how to change the colors for root-privilege applications separately from the run of the system -- I'll find or make a color scheme does the job for me.

                        Edit: I tried to hit the "thanks" button like I'd do over on the Mepis forum -- and there isn't one. Well, thanks, anyway.
                        Last edited by Silent Observer; Aug 03, 2014, 10:38 AM. Reason: Added thought

                        Comment


                          #13
                          Originally posted by Silent Observer View Post
                          Edit: I tried to hit the "thanks" button like I'd do over on the Mepis forum -- and there isn't one. Well, thanks, anyway.
                          We haven't implemented the thanks or reputation features here. Thanks buttons become useless competitions, especially when people beg for them (see the XDA Developers Forum). Reputation rankings can prematurely bias the opinions of others.

                          Comment


                            #14
                            Originally posted by SteveRiley View Post
                            ... Thanks buttons become useless competitions...
                            We needn't count them, or display totals. A thanks button would help KFN junkies like me who try to read every post...

                            Regards, John Little
                            Regards, John Little

                            Comment


                              #15
                              Originally posted by jlittle View Post
                              A thanks button would help KFN junkies like me who try to read every post...
                              How so?

                              If you allow the browser to save your password, and also ensure that you keep the cookie from KFN, then the forum software will keep track of what you have and haven't read. You can click New Posts in the header and get caught up on everything that's new.

                              Comment

                              Working...
                              X