LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 07-28-2012, 12:35 PM   #1
tbrownarcher
Member
 
Registered: Oct 2005
Location: Iowa
Distribution: Ubuntu
Posts: 108

Rep: Reputation: 17
i need to access the /ec/hosts file


I am in the terminal and trying to access the /etc/hosts but i get the message "Permission denied so I run the command 'su' it asks for my password I type in the password and then do the command to go to /etc/hosts and it tells me permission denied.... what is it i'm doing wrong ??



nate@Nate3 ~ $ /etc/hosts
bash: /etc/hosts: Permission denied
nate@Nate3 ~ $ su
Password:
Nate3 nate # /etc/hosts
bash: /etc/hosts: Permission denied
Nate3 nate #

thanks,
Nate
 
Old 07-28-2012, 01:04 PM   #2
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
/etc/hosts isn't a script or anything, it's basically just a configuration file. So, trying to run it on the command line as you are makes no sense. FWIW, you get the permission denied message because the file doesn't have execute permissions (again, because that makes no sense for the type of file it is). You need to edit it with whichever editor you use.

Last edited by Nylex; 07-28-2012 at 01:05 PM.
 
1 members found this post helpful.
Old 07-28-2012, 01:18 PM   #3
lithos
Senior Member
 
Registered: Jan 2010
Location: SI : 45.9531, 15.4894
Distribution: CentOS, OpenNA/Trustix, testing desktop openSuse 12.1 /Cinnamon/KDE4.8
Posts: 1,144

Rep: Reputation: 217Reputation: 217Reputation: 217
Quote:
Originally Posted by Nylex View Post
/etc/hosts isn't a script or anything, it's basically just a configuration file.
...
You need to edit it with whichever editor you use.
Code:
#vim /etc/hosts  <--- edit
#cat /etc/hosts    <--- view output in terminal
 
Old 07-28-2012, 01:19 PM   #4
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
You can also use pagers (e.g. less, more, most) to view the file.
 
Old 07-28-2012, 04:32 PM   #5
tbrownarcher
Member
 
Registered: Oct 2005
Location: Iowa
Distribution: Ubuntu
Posts: 108

Original Poster
Rep: Reputation: 17
Thanks , I got it

Nate
 
Old 07-28-2012, 04:42 PM   #6
tbrownarcher
Member
 
Registered: Oct 2005
Location: Iowa
Distribution: Ubuntu
Posts: 108

Original Poster
Rep: Reputation: 17
Thanks , I got it

Nate
 
Old 07-28-2012, 09:06 PM   #7
Dutch Master
Senior Member
 
Registered: Dec 2005
Posts: 1,686

Rep: Reputation: 124Reputation: 124
In addition, nano is an easier editor to use if you can't (be bothered to) memorise the incredible amount of short cuts/key strokes you'd need for vim or emacs
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Hosts file not blocking access to websites sabresong Linux - Newbie 4 01-08-2012 12:06 PM
Access denied for NFS - but hosts.allow and hosts.deny seem OK royce2020 Linux - Networking 4 10-17-2011 10:44 PM
can't restrict sshd access through hosts.allow and hosts.deny but was working earlier farhan Linux - Security 4 04-18-2008 07:41 AM
/etc/hosts.deny/hosts.allow have no effect on sshd access bganesh Linux - Security 4 05-04-2006 08:06 PM
does the /etc/hosts file work same as the M$ hosts file? Lleb_KCir Linux - Software 6 04-03-2004 04:33 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 10:54 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration