1

I'm new to Linux of any flavor and am having a little trouble. I am attempting to install Cloudera CDH 5 onto an Ubuntu computer I have setup to be part of the Hadoop cluster. Per Cloudera's install guide Trusty (14.04) users need to prioritize the Cloudera repository to prevent an issue with some Zookeeper packages.

To do so they instruct you to create a file at /etc/apt/preferences.d/cloudera.pref with some specific text contained inside.

However, when I navigate to /etc/apt/preferences.d/, New Document on the right-click menu is greyed out.

Thus my questions:

  1. How would I go about creating the needed file in that directory?
  2. Given that I'm the admin, how would I go about changing the right setting such that I can create/edit any file in any directory (like the admin permissions in Windows)?
aastefanov
  • 1,399
JMichael
  • 113

1 Answers1

1

Most directories under /etc will require root privileges to create files in. Unfortunately, the default file browser doesn't provide a quick-n-easy method to escalate privileges for a single operation. The command line is your answer.

sudo nautilus will launch a copy of nautilus w/ root privileges, allowing you to do whatever you want. I'm not sure that's a good idea (easy to leave it open and forget that it has super powers), but it's convenient in some cases.

sudo touch /etc/apt/preferences.d/cloudera.pref will create an empty file. Once you've done that, you could do something like sudo chown some_user /etc/apt/preferences.d/cloudera.pref to change ownership or sudo chmod a+rw /etc/apt/preferences.d/cloudera.pref to open read/write privs to everyone (generally a bad idea) You can also set user & group on a file at the same time:

sudo chown some_user:some_group /etc/apt/preferences.d/cloudera.pref

or just set the group ownership:

sudo chgrp some_group /etc/apt/preferences.d/cloudera.pref

an ls -l (or using your graphical browser w/ the right settings) will display the ownership/permission details for verification.

You could create the file and set it to be owned by your user for temporary convenience, edit it using your convenient GUI editor if you want, then set ownership back to root or whatever you want it to be for proper security.

Typically, /etc contains static configuration files, so you make them readable by certain groups of users (even all users, if not sensitive) but reserve write privs for root. I don't know anything about Cloudera, but it's common to have software running under a particular user (and a user can be a member of multiple groups) so you can set the group of the file to be the group that you want to have privs on it.

muru
  • 207,228