Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Is it possible to password access to a single file?
For example, on my machine I'm running Ubuntu 9.04, with a single user, although in order to modify certain aspects of the system I must use my super-user password (in case others use my pc). So I know my su password. I'm trying to find out if its possible to make my /etc/hosts file passworded by one of my friends, so that I cannot edit the file at all.
Its basically to make sure I dont visit the sites listed with bogus addresses during term-time (I use linux for work, windows for downtime).
Its basically to make sure I dont visit the sites listed with bogus addresses during term-time (I use linux for work, windows for downtime).
1. if they are bogus addresses(!), there's no site to visit
2. /etc/hosts is only relevant to your lan; on the web your ISP's DNS will take you to anywhere you want.
Also, if you know the IP, you don't need the name.
3. If you've got root, chattr won't stop you, for obvious reasons.
4. the only password protections I can think of all involve encryption, which would break the OS ie it HAS to be able to read that file to work.
5. maybe you're thinking if your friend owns the gateway box and locks you out of certain external websites using squid. Potentially this could work internally (LAN) as well if you have to go through that box.
Is it possible to password access to a single file?
For example, on my machine I'm running Ubuntu 9.04, with a single user, although in order to modify certain aspects of the system I must use my super-user password (in case others use my pc). So I know my su password. I'm trying to find out if its possible to make my /etc/hosts file passworded by one of my friends, so that I cannot edit the file at all.
Its basically to make sure I dont visit the sites listed with bogus addresses during term-time (I use linux for work, windows for downtime).
Is this possible?
Many thanks,
EN
Obviously the goal can be achieved by encrypting the file with a password. This circumvents the filesystem protection and user scheme, for just this one file. BUT ... the file will be unreadable by the system and will be of no use. The file /etc/hosts has an important purpose on your system, and encrypting it basically makes it inaccessible.
Obviously the goal can be achieved by encrypting the file with a password. This circumvents the filesystem protection and user scheme, for just this one file. BUT ... the file will be unreadable by the system and will be of no use. The file /etc/hosts has an important purpose on your system, and encrypting it basically makes it inaccessible.
So I guess I don't understand your question.
Christ I'm so sorry I was intending to post yesterday but completely forgot!
Thats what I was afraid of in regards to encrypting, which seems the only option as far, but I cannot encrypt my hosts file!
What I need is for my hosts file, when opened, to prompt for a password. This password will be known by one of my housemates, not by me. Effectively he will be the only one that can edit my hosts file.
I've been doing a fair bit of research on this matter, and as of yet of what I have seen it does not seem possible to do this. Encryption is defiantly the best method, but not possible in this case.
chrism01: In response to your questions, in this case I will be on the university campus. In my hosts file I setup each domain which I should not be able to access with the IP of 0.0.0.0, so my OS resolves each of the those domains to that address. Works well, I had no idea that it would include top-level and sub domains!
Fortunately in my house our router is in my room, so I'm king of the house internet ^^
The case is that I want to be in my lectures, getting amazingly bored, and as so often happens decide to go on miniclip or facebook or something of the such, drawing my attention away from the lectures droning voice. By blocking these sites stop me from being able to do that. Of course, what stops me from just editing the hosts file and removing those domains entries? Nothing! Thats where the problem lies.
If only I knew how to code in anything but HTML CSS & Javascript, would definatly be good to knock something up!
Whats the primary coding language Linux uses? Is it Python? Is it possible to be able to create a script which passwords a specified file? If it is, I'll get on the case!
Thank you so much for your responses, once again the Linux community comes to the aid of its new users.
Well, as mentioned, as far as your machine goes, it's not possible.
You've got root and you can't encrypt /etc/hosts without breaking the system.
If you were on a landline and had to go through a proxy (as I said) then you could get your friend to own the proxy and lock you out.
If you are using wireless from the lecture and using a random wireless port/server, then you're just going to have to learn some self-discipline.
You could go old school and not take your laptop, take a pen & paper like I had to.
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789
Rep:
Quote:
Originally Posted by pixellany
J'ai pensee qu'on dit typiquement: "Vous avez raison."
You are right, "vous êtes correct" is understandable but not idiomatic French. As we are in this topic, the first part of your sentence can also be improved: "J'ai pensee ..." should have been "J'ai pensé que l'on disait" but you really meant "Je pense que l'on dit typiquement". Unfortunately that doesn't sounds like typical French either. I would have simply written: On dit plutôt: « Vous avez raison. »
Quote:
We must stop speaking French before a moderator catches us.....
@Tinkster: now that looks interesting. You can still do a reboot, but at least it makes you think a bit more.
TBH though, I'd recommend the OP learn some self-discipline as well; he/she is going to need it later in life.
@Tinkster: now that looks interesting. You can still do a reboot, but at least it makes you think a bit more.
TBH though, I'd recommend the OP learn some self-discipline as well; he/she is going to need it later in life.
True. But it's a nice tool to enforce it ;}
Not that I've ever used it - I just remembered seeing it when
I stumbled over Thomers homepage looking for vi stuff ages
ago, and having a good laugh.
Not so much about the tools' intended purpose, but because I
though the use of language, and his geeky humour were fab.
You could go old school and not take your laptop, take a pen & paper like I had to.
Ne'er have I heard such blashpemy! As I'm sure as it is with most people on this forum, I can type faster than I write.
But on a lighter note, Lockout looks pretty much what was needed. Helpful, dangerous with the possibility of messing up my os with a large serving of humor on the website; perfect mix? I think so!
And the French is absolutely fine, but next time try using it backwards with every fourth letter presented in Binary; that'll make things interesting.
Will be testing Lockout on a crappy lappy of mine to make sure its configurable without fucking everything up the arse.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.