View Full Version : bashrc cant edit & change anymore ?

11-22-2003, 02:21 AM
I tried to change the server time as posted in a thread by FZ, but when I tried to edit it via pico or ftp upload it says file access denied.

So how do I go about it to change the server time then ?

any help appreciated - wow ssh is real powerful .. :)


11-22-2003, 06:10 AM
Where are you trying to edit or upload it?

The .bashrc file that you need is the one in the root "/" directory. The others are links that are owned by root.

11-23-2003, 04:15 PM
Yes it's the one in the root...

11-23-2003, 04:39 PM
This was an initial 2.0 problem that I pointed out in the early days. WestHost fixed it shortly thereafter for all accounts, though. Weird that they missed your account. Type this at the SSH command prompt (while in the root / directory):

ls -Al

The line for .bashrc should look (something) like this:

-rwxr-xr-x 1 username vuser 1407 Nov 23 18:34 .bashrc

Dates will obviously be different, and "username" should be your username, not root. If it is root, then you know that the fix did not "reach" your account. If this is the case, just send in a support request for it.

11-23-2003, 08:45 PM
Thanks man, yes it's as mentioned FZ, I'll shoot them a ticket.

11-24-2003, 04:18 AM
Yes, I've successfully changed the time on the server as suggested in your thread. http://forums.westhost.com/phpBB2/viewtopic.php?t=1105&postdays=0&postorder=asc&start=15
But the log files still show mountain time. But as you mentioned it will show the time as changed in the log files.
No ?

11-24-2003, 11:02 AM
It seems that the solution is a really really buggy and ineffective one, in that some things are affected and others are not. I just checked my Apache logs and it seems that they've reverted to mountain time as well (even though my timezone change effort is still in effect). What I have noticed is that whatever is being run (e.g. Apache or Procmail or a Perl script), needs to be run as your username and not root. If run as root, your TZ variable is ignored. For example, I notice that my AWStats updates that are done via a cron job show that the last update time is shown as mountain time; however, if I manually update it (by clicking update or running the script) then the time shown is my own. I'm sorry it did not work out as you expected. I will see if I can try and figure out how Apache was working before...

11-24-2003, 09:40 PM
Hmmm, thanks for the sharing to even how to do it FZ.
I'll also do some asking around.. & see how to do it. Thanks.

11-25-2003, 07:43 PM
Just got a reply from tech about this bashrc thing
"The change you made to the .bashrc file won't effect the time that is recorded in the access logs. If possible, whatever program or script you use to parse the logs would need to be configured to compensate for the time difference so when you view the stats it would show your local time instead of the server time. "

So maybe there's no hack after all FZ :)

11-26-2003, 04:49 AM
Guess not! Wonder why it worked for me initially... :?

11-30-2003, 07:31 AM

It seems a simple restart command via SSH applies the timezone changes to Apache. I logged in via SSH, typed restart pressed enter, and then accessed a page on my site (any page), then I typed tail -n 3 /var/log/httpd/access_log and immediately saw that the timestamp had changed from -0700 (Mountain Time) to +0200 (Central African Time). Give it a try and see if it works for you as well. I'll monitor it over the next few hours/days to see if it reverts back by itself (and possibly find out why it does that). Also, note that if you get it working, the old records in your access_log (the ones recorded with Mountain Time) are NOT changed, only new records are affected.

12-02-2003, 01:13 AM
Strange that I did not receive a notification on this post, sometimes I get sometimes I dont
However I havent tried it yet, but as mentioned by you, I've tried the restart via ssh after setting the changes previously it still did not work although in ssh the time is as my local time.
Will try it again & see what happens.
Thanks..keep you all posted

12-02-2003, 08:02 PM
So I've tried it again & it does not work.
The log time is still the same. So is yours reverted ?
Could this be a difference with an IP based & name based account ?

12-02-2003, 08:26 PM
Weird. Nope, mine is still set to the custom value. It's highly unlikely that this is a IP vs name-based issue. FYI, I have a dedicated IP with my account and I am not on a reseller. Is the timezone change showing up when you SSH in and do an 'ls -al' (after closing SSH the first time, and then going back in)? How did you do the actual restart - via SSH or the Site Manager? If via the Site Manager, try it via SSH...

12-02-2003, 10:49 PM
I did it all in ssh, I picoed the bashrc then the init.
I added export TZ=GMT-4 in .bashrc
TZ=GMT-4 in init file

then type restart & relogin & type date it shows the changed time in ssh session.

after i type restart it has also ls/rc.d/ no such file or directory

is that normal ?

12-03-2003, 07:07 PM
TZ=GMT-4 in init file

I never had to do that. Which "init file" are you talking about?

after i type restart it has also ls/rc.d/ no such file or directory is that normal ?

Nope, since I didn't bother with init file(s), I haven't seen this :?

12-03-2003, 07:29 PM
Hmm but I read in your post in message 5 " Additionally, you should change the TZ value in the /etc/default/init file - not sure what that one does though."

That's the file that I changed from Eastern to GMT-4

So you recommend that I dont change ?

So here's my steps again:
login via ssh
type export TZ=GMT-4
type date to see if correct tme with yours

pico .bashrc
put in export TZ=GMT-4
press CTRL + X
press Y
press Enter

goto cd /etc/default/init
pico init
change default TZ=US/Eastern to TZ=GMT-4
press CTRL + X
press Y
press Enter

type restart
then press date to see if time is now set correctly to your timezone in ssh.

access the site to create a error in the log & then download the log to see if the time has changed.

So did I do it correctly ?

12-04-2003, 11:25 AM
Sorry about the init file thing, forgot about that one :oops:

Your steps are all correct - I'm stumped :? The only thing I can think of is that after typing "restart", you did not quit your SSH session and then start another one (so that the changed .bashrc is read again). You might want to try that - restart your SSH session and THEN "restart" at the command prompt once more (to restart Apache, etc.), and then check to see if the time change is reflected or not. If it doesn't work, sorry I can't see what's wrong :(

12-04-2003, 06:33 PM
Hmm, very strange.
So in the init file I dont have to type the " export " word before the TZ

I'm going to try it on my IP based account & see what happens.

12-04-2003, 08:54 PM
Guess what - it's only IP based accounts that you are able to activate such change :?:
well we'll have to stick with it.
But thank you very much Fayeez for assisting me in my dilemma, I've added you to my kind soul list :lol: 8)

12-05-2003, 12:04 PM
That sucks :( I guess now that you have confirmed this, it does kind of make sense - maybe IP based accounts get to run Apache as their own username and others don't, so in the former case, your changes are taken into affect and not in the latter. Anyway, at least we know what's wrong now. You should consider upgrading your account, it's only $1 extra/month for your own IP ;) But then you should have more than this (custom timezone) as a reason for wanting to do that. And you're welcome :D

12-12-2003, 03:48 AM
Hmm it looks like my vps has returned to mountain time.

I check the error logs & it looks like after 2 restarts, it goes back to mountain time. ? You have the same thing ?

12-12-2003, 08:41 AM
I think if WestHost is the one that does the restart on the Apache processes, then it goes back to Mountain time - since it will ignore your TZ change. Because this was really starting to mess my web statistics up, I've actually removed the TZ customization entirely. It's just not a good solution.

12-12-2003, 11:53 AM
I don't really understand why you want to change the time zone away from what the server is running on. It seems a recipe for problems...


12-12-2003, 12:01 PM
Hey, we can hope can't we? ;) Actually, the time difference is so great for me, (+8 or 9 hours) that I'd really love to not have to do the calculation in my head everytime I look at a timestamp in my logs, etc. which is why I would have liked to do a time zone customization.

12-12-2003, 09:11 PM
Since Jalal mentioned about having problems - I think I better stick with mountain time then. Coz I dont know if my emails problem sending under the same domain is affecting it... I've not been able to receive emails sent by my colleagues under the same domain name.
Dont know what's the problem.. submitted a ticket but still no fix yet.

You guys know anything ?

So the emails was related to my isp smtp server settings - i've set it to my domain now :)

12-12-2003, 09:30 PM
I remember reading something about that kind of problem. I think it had to do with aliases or something. As far as I can recall, the solution was to give the e-mail address you are using a home directory (i.e. give that account FTP access and then remove the FTP access, which will keep the assigned home directory).

12-26-2003, 05:03 PM
Hey guys,

I just wanted to chime in about the home directory issue. Basically, enabling FTP has the side-effect of creating a home directory for the user, and disabling it should keep that home directory. Sendmail particularly, when scripts invoke it, likes to throw up and halt when there isn't a home directory for the user, so enabling FTP for an account receiving email often will fix these sorts of problems.

Note that this is not an SMTP issue; these accounts, when email is sent via SMTP, seem to receive it just fine. It seems localized to accounts that are being sent to via sendmail, and also seems to only affect inter-account sends or inter-server sends, as far as I can tell.

12-28-2003, 07:19 AM
Are we supposed to be able to edit our .bashrc file? I was able to until about a month ago, contacted WestHost support and was told I was not allowed to edit it.

12-28-2003, 07:53 AM
Ask them to make it owned by the site owner. I did that and they told me that it was a mistake that it should be owned by root and changed it.

12-29-2003, 10:44 PM
Then should I contact them to change it back for me, as I see my time switches from mountain & local time daily ?