Editing file with kdesu requires full path to the file

Hi, I’m new openSUSE and while I’m trying to figure out how things work there is one thing that I couldn’t find an answer to about kdesu command.

For instance, if I changed folders to /etc/X11 and I want to edit xorg.conf I need to run the following command:

kdesu kwrite /etc/X11/xorg.conf

while I’d expect to run the following:

kdesu kwrite xorg.conf

but without the full path it opens an xorg.conf file in a folder somewhere in my home folder (but not directly under /home/user/).

I assume this is normal, but is there a way around it? If I want to edit several files under the same folder I’d rather not have to type out the full path to the each of the files.

Thanks in advance.

One way that might work:


kdesu kwrite ./xorg.conf

One way that does:


su -
kwrite xorg.conf

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Kinda, but remember that kdesu is starting a new environment as another
user (‘root’ in your case) so being exact is not only a good idea, it may
be required:

kdesu kwrite pwd/xorg.conf

Good luck.

Untitled No4 wrote:
> Hi, I’m new openSUSE and while I’m trying to figure out how things work
> there is one thing that I couldn’t find an answer to about kdesu
> command.
>
> For instance, if I changed folders to /etc/X11 and I want to edit
> xorg.conf I need to run the following command:
>
> Code:
> --------------------
> kdesu kwrite /etc/X11/xorg.conf
> --------------------
>
>
> while I’d expect to run the following:
>
> Code:
> --------------------
> kdesu kwrite xorg.conf
> --------------------
>
>
> but without the full path it opens an xorg.conf file in a folder
> somewhere in my home folder (but not directly under /home/user/).
>
> I assume this is normal, but is there a way around it? If I want to
> edit several files under the same folder I’d rather not have to type out
> the full path to the each of the files.
>
> Thanks in advance.
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJLGD/OAAoJEF+XTK08PnB5jhUQAJd0A3NshrRm6Dycd8yWw56S
wvMvCc51J6GEtZHw8GL8znvi8Y2WniEmjIcbAuV/TWEfsDz76FfFLZ+UKKLB4S7W
N0nbq0NlEYKN2Y97R/OZV8EuVIFJY4D76wbdc+0FEZxm3SWboYIb2o9OCxL+cfuY
A2OUv2SYFcyRAhy/f/XFBSOzoq61G4i0sz43ox10azYQdg56ncBBtYISk4M4EP3K
NLKoxNorjH9pw0t/TKcvqZL7vMu1fK/0ykHXYbEZD6NAPiY7VVSaa/YrSMGtcuZE
81t/o+0F905YR3mncdIDXFXJPz9mt1dz6mZypMCtuGb1sJLlcIUr1MQa1icJG2F9
4ETs6fSqWjh7C5JNOE+ELDlXdl7wycD7x9spCEGHJN0VF3RFyfdp2bUQaTmQKPKt
49bUZF0mqG97LLSOnd8lilvk2o9aSEqLcaHoUvPQEMUeMcpXdlPrPwhWeMIDCMc9
AdFVgPmYnAYvkHKCPzdzlZ3YGLPKua4V9tmMEy2lj8bFDcXNM3koPWlhR/vI0xas
9lCxkzGZppcmr54fPVZG0VLYXtFQtbN9g/TLX6i/QhHX0qlSE43DNg4eV4ZKyl5P
NhKLmoDykActARNoiFh50ukr42PQSdv6MFXP99mx/U+5JZWY26dnxe2eCBBf4ye2
M056b25QiQ6ZxaS9d77X
=EZfp
-----END PGP SIGNATURE-----

Did you realy expect that kdesu or kwrite or whoever invented that you need the xorg.conf inside /etc/X11 and not one inside /bin or elsewhere?

You could use a terminal as root and then you cd to the directory you want to be. Then you could use vim or any other CLI tool to let loose on the names found within your working directory.

For different ways do do things as root (some ways are easier to use in some circumstances then others) see: SDB:Login as root - openSUSE

I didn’t expect kdesu to to guess anything hence why I wrote AFTER changing directories to /etc/X11. Perhaps that’s too much to expect but since kdesudo does just that I thought that perhaps somehow kdesu might work the same way.

Thanks for the other suggestions – none worked for me but it was still worth-while asking.

Running ‘su -’, then 'cd’ing to the right directory, then running kwrite without the absolute path should…

Unless I’m going nuts. But it seems to here…

Just don’t use a normal ‘su’, and my understanding is that the problems kdesu and gnomesu are designed to avoid are avoided.

[Someone correct me if I’m wrong…]

Sorry, you’re right, it does work.

I also tried compiling kdesudo but it doesn’t work the same way it does in other distributions, but the questions was me wanting to know whether I missed anything.

Thanks again.

No need to apologise, and you’re welcome.

Of course one should use

su -

That is clearly stated in the link I provided above. Leaving out the - is a security risk. This is btw illustrated by Untitled_No4. He (as root) is editing another file then he thought he would do.

> Code:
> --------------------
> su -
> --------------------

i had a ‘big’ discussion with others in one of these fora here within
the last month or so…trying to persuade them use the dash when they
wanted to be root…

and, i got such a coordinated stonewall about how wrong i was that i
finely decided to just be quiet and let them do it any way they
want…even if wrong…oh, i think it was a new how-to…i don’t
remember exactly…

oh, i found it…here it is, read and grin:
http://forums.opensuse.org/showthread.php?t=424498


palladium

@palladium
It is good for my health I did not notice that thread because it is full of awfull things :(.

Sorry, I will not start to venture into it from this thread, it being utterly off topic. The only thing is, why is such a howto not even mentioning the SDB I showed above? The noob will have a difficult time to understand all the well meant contradictionary advice here.

hcvv wrote:
> Sorry, I will not start to venture into it from this thread

maybe you would add to the how-thread, maybe you can show them the
light…maybe.


palladium

Said link has been blank for me for two days.

And if my advice is wrong, please do tell me - I will defer to more knowledgeable judgement on this one.

But I’ve been told that the reason you need gnomesu and kdesu (apart from when something outright won’t run in the first place) is to avoid the cross-contamination of permissions / ownership caused by running something as one user but in another’s environment. And I believe that I’ve been told that that isn’t an issue with an ‘su -’, ergo that if it runs, it’s fine.

@Confuseling
You are right. The link is dead. Worse, the whole SDB is dead >:(

I saw that they went over to new systems, new wiki software, etc. Let us hope everything will come back in due time, else a lot of errort will be lost.

Before we hyjack somebody else’s thread I will go over to the other thread, read it carfully and comment on it tomorrow. Is that OK?
(might be later on the day tomorrrow, I have things to do)

No rush by me!

If doing that breaks it, I’ve broken it by now… >:)

:stuck_out_tongue: