The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Open source video editing: what we have now and what we need iBot UNIX and Linux RSS News 0 04-10-2008 05:00 PM
How to editing a txt file aaabbb123123 Shell Programming and Scripting 3 03-07-2008 12:31 AM
Editing File using awk/sed Mohammed Shell Programming and Scripting 4 05-16-2007 12:00 PM
Editing the File using Awk awk_beginner Shell Programming and Scripting 3 04-06-2007 11:43 AM
File editing using awk rinku11 Shell Programming and Scripting 2 11-23-2006 11:34 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 08-23-2008
jon80 jon80 is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 12
can't open file for editing

I've created a user and would like to an an alias to the .bashrc file, however when I use vi and write to the file the following is displayed:

".bashrc" E212: Can't open file for writing. Hit ENTER or type command to continue.

Entry within /etc/passwd for this user reads:
maqui:x:513:516::/home//maqui::/bin/bash

  #2 (permalink)  
Old 08-23-2008
ynilesh's Avatar
ynilesh ynilesh is offline
Registered User
  
 

Join Date: Oct 2007
Location: Bangalore, India.
Posts: 222
which os?

how did u create a user ? did u create your home directory manually ? do u have enough permission to write into file ?

- nilesh.
  #3 (permalink)  
Old 08-23-2008
jon80 jon80 is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 12
Thanks for the hint I created .bashrc manually and now it seems to work. So basically:

1. I created user using adduser
2. Updated alias within the home directory i.e. /home/<user>
3. Updated permissions on the source file using chmod 755, so that the user can execute the file.

Did I "allow too much" in step 3?
  #4 (permalink)  
Old 08-23-2008
era era is offline Forum Advisor  
Herder of Useless Cats (On Sabbatical)
  
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,652
What do you mean by "alias"? A symbolic link to /etc/skel/.bashrc? Doesn't adduser automatically copy in a fresh .bashrc for you?

If you are editing .bashrc and it's a symbolic link, you need write permission to the target of the symbolic link. But instead, you should have a separate file owned by the user, usually a copy of /etc/skel/.bashrc

If you are editing a file owned by a different user, you need to be root, or the file's permissions need to be relaxed enough to allow you to overwrite the file (and, the way editors often work, probably write access to the directory). This is of course not really a good idea in any event.

.bashrc doesn't need execute permission, it's sourced (not executed) by bash.

Last edited by era; 08-23-2008 at 03:29 PM.. Reason: Don't need execute permission; need write access to target of symlink
Closed Thread

Bookmarks

Tags
bashrc, permissions, vi_editor

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 04:30 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0