Unix Technical Forum

Access denied

This is a discussion on Access denied within the Debian Linux support forums, part of the Debian Linux category; --> I want to open a file in the directory: /var/lib/asterisk/agi-bin with a text editor like Kate. (as normal user, ...


Go Back   Unix Technical Forum > Unix Operating Systems > Debian Linux > Debian Linux support

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-19-2008, 08:41 AM
Henk Oegema
 
Posts: n/a
Default Access denied

I want to open a file in the directory: /var/lib/asterisk/agi-bin with a
text editor like Kate. (as normal user, to copy and paste some text to
another file)

However... Acces denied.

Q: How can I open a file in a texteditor with root priviliges?


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 01-19-2008, 08:41 AM
Philip Bernstein
 
Posts: n/a
Default Re: Access denied

Hi,

I would think either su to root or sudo would work.

Henk Oegema wrote:
> I want to open a file in the directory: /var/lib/asterisk/agi-bin with a
> text editor like Kate. (as normal user, to copy and paste some text to
> another file)
>
> However... Acces denied.
>
> Q: How can I open a file in a texteditor with root priviliges?
>
>


--
Philip Bernstein
ppberns@hvc.rr.com


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 01-19-2008, 08:41 AM
Mutant
 
Posts: n/a
Default Re: Access denied

On Oct 13, 7:11 am, Henk Oegema <h...@oegema.com> wrote:
> I want to open a file in the directory: /var/lib/asterisk/agi-bin with a
> text editor like Kate. (as normal user, to copy and paste some text to
> another file)
>
> However... Acces denied.
>
> Q: How can I open a file in a texteditor with root priviliges?


Here are two sorta quickies.

1.) start Xterm. And su with your fav_editor.

2.) several distros have a "run command" listing that can be run as
another user, including but not limited to root.

- Peace -

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 01-19-2008, 08:41 AM
Rodney
 
Posts: n/a
Default Re: Access denied

On Sat, 13 Oct 2007 11:11:43 +0000, Henk Oegema wrote:

> I want to open a file in the directory: /var/lib/asterisk/agi-bin with a
> text editor like Kate. (as normal user, to copy and paste some text to
> another file)
>
> However... Acces denied.
>
> Q: How can I open a file in a texteditor with root priviliges?



Henk, you should get in the habit of giving a bit more information
when you ask a question [1]. Yours is a question that is somewhat
dependent on which distro you are using.

The generic answer is, open the text editor as root, then navigate to the
file you want to edit and open it. (That answers your question, but
probably doesn't help you much.)

How you open the text editor as root is the part that depends on the
distro.

Some distros automagically put the regular user in the sudoers, so
all you would have to do would be prepend the sudo command, in a terminal,
to the comand for your editor, in this case kate (As per your example,
sudo kate /var/lib/asterisk/agi-bin). Other distros do not put the regular
user in sudoers by default, so in them that wouldn't work unless you had
set the user up as an sudoer. The command su, in a terminal, followed when
prompted, by the root password would make root the user of that terminal
and then, with the command kate you could open kate as root.

This is a good time for you to read the manual pages for the two commands:
man su
man sudo

These are not the only ways you could set up your system to have it work
but they are probably enough for now.

[1] http://www.catb.org/~esr/faqs/smart-questions.html

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 01-19-2008, 08:41 AM
Henk Oegema
 
Posts: n/a
Default Re: Access denied

Rodney wrote:


> Some distros automagically put the regular user in the sudoers, so
> all you would have to do would be prepend the sudo command, in a terminal,
> to the comand for your editor, in this case kate (As per your example,
> sudo kate /var/lib/asterisk/agi-bin). Other distros do not put the regular
> user in sudoers by default, so in them that wouldn't work unless you had
> set the user up as an sudoer. The command su, in a terminal, followed when

Thanks Rodney

I'm using Debian 4.0r1 with GUI KDE

henkoegema@asterisk:~$ su
Password:
asterisk:/home/henkoegema# kate
Xlib: connection to ":0.0" refused by server
Xlib: No protocol specified

kate: cannot connect to X server :0.0
asterisk:/home/henkoegema#


However... as normal user I can open Kate !

> prompted, by the root password would make root the user of that terminal
> and then, with the command kate you could open kate as root.
>
> This is a good time for you to read the manual pages for the two commands:
> man su
> man sudo


henkoegema@asterisk:~$ man sudo
No manual entry for sudo
henkoegema@asterisk:~$ kate

[1]+ Stopped kate
>
> These are not the only ways you could set up your system to have it work
> but they are probably enough for now.
>
> [1] http://www.catb.org/~esr/faqs/smart-questions.html


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 01-19-2008, 08:41 AM
Jacob Tranholm
 
Posts: n/a
Default Re: Access denied

Henk Oegema wrote:
>
> I'm using Debian 4.0r1 with GUI KDE
>
> henkoegema@asterisk:~$ su
> Password:
> asterisk:/home/henkoegema# kate
> Xlib: connection to ":0.0" refused by server
> Xlib: No protocol specified
>
> kate: cannot connect to X server :0.0
>


Try 'sux' from command line instead of 'su'.
You have to install it (apt-get install sux)...

--
Best regards Jacob Tranholm <http://jtranholm.dk/>
Karl R. Popper: Observation statements and statements of experimental
results are always interpretations of the facts observed.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 01-19-2008, 08:41 AM
Anton Ertl
 
Posts: n/a
Default Re: Access denied

Henk Oegema <henk@oegema.com> writes:
>henkoegema@asterisk:~$ su
>Password:
>asterisk:/home/henkoegema# kate
>Xlib: connection to ":0.0" refused by server
>Xlib: No protocol specified
>
>kate: cannot connect to X server :0.0
>asterisk:/home/henkoegema#


Easy: between su and kate, do the following:

cp /home/henkoegema/.Xauthority ~

That's quick and dirty; if you have another session as root that also
needs X, for a different display, use xauth to get the autority
instead; I guess that sux tool someone else mentioned does that for
you. Don't do "xhost +", it's a huge security hole: It allows
everyone to access your display.

- anton
--
M. Anton Ertl Some things have to be seen to be believed
anton@mips.complang.tuwien.ac.at Most things have to be believed to be seen
http://www.complang.tuwien.ac.at/anton/home.html
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 01-19-2008, 08:41 AM
Henk Oegema
 
Posts: n/a
Default Re: Access denied

Anton Ertl wrote:

> Henk Oegema <henk@oegema.com> writes:
>>henkoegema@asterisk:~$ su
>>Password:
>>asterisk:/home/henkoegema# kate
>>Xlib: connection to ":0.0" refused by server
>>Xlib: No protocol specified
>>
>>kate: cannot connect to X server :0.0
>>asterisk:/home/henkoegema#

>
> Easy: between su and kate, do the following:
>
> cp /home/henkoegema/.Xauthority ~


henkoegema@asterisk:~$ cp /home/henkoegema/.Xauthority ~
cp: `/home/henkoegema/.Xauthority' and `/home/henkoegema/.Xauthority' are
the same file
henkoegema@asterisk:~$


>
> That's quick and dirty; if you have another session as root that also
> needs X, for a different display, use xauth to get the autority
> instead; I guess that sux tool someone else mentioned does that for
> you. Don't do "xhost +", it's a huge security hole: It allows
> everyone to access your display.
>
> - anton


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 01-19-2008, 08:41 AM
Henk Oegema
 
Posts: n/a
Default Re: Access denied

Rodney wrote:

>
>>
>> (2007/10/13) Rodney wrote:
>>> What happens when you try the command string- kdesu kate
>>> /var/lib/asterisk/agi-bin
>>>
>>> If that didn't work try the command xhost +localhost then the command
>>> string to start kate as su.
>>>

>
> ?
>
> [code]
> kdesu kate /var/lib/asterisk/agi-bin


asterisk:/home/henkoegema# kdesu kate /var/lib/asterisk/uptime.php
Xlib: connection to ":0.0" refused by server
Xlib: No protocol specified

kdesu: cannot connect to X server :0.0


>
> [code]
> xhost +localhost
> su
> password:
> kate /var/lib/asterisk/agi-bin
>
> ?


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 01-19-2008, 08:41 AM
Anton Ertl
 
Posts: n/a
Default Re: Access denied

Henk Oegema <henk@oegema.com> writes:
>Anton Ertl wrote:
>
>> Henk Oegema <henk@oegema.com> writes:
>>>henkoegema@asterisk:~$ su
>>>Password:
>>>asterisk:/home/henkoegema# kate
>>>Xlib: connection to ":0.0" refused by server
>>>Xlib: No protocol specified
>>>
>>>kate: cannot connect to X server :0.0
>>>asterisk:/home/henkoegema#

>>
>> Easy: between su and kate, do the following:

^^^^^^^^^^^^^^^^^^^
>>
>> cp /home/henkoegema/.Xauthority ~

>
>henkoegema@asterisk:~$ cp /home/henkoegema/.Xauthority ~
>cp: `/home/henkoegema/.Xauthority' and `/home/henkoegema/.Xauthority' are
>the same file


I have underlined the part you did not heed.

- anton
--
M. Anton Ertl Some things have to be seen to be believed
anton@mips.complang.tuwien.ac.at Most things have to be believed to be seen
http://www.complang.tuwien.ac.at/anton/home.html
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 02:25 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com