CRC on server - how to get?


#1

How can I obtain the CRC of a file on the server?

This seems such a simple and cheap thing (cheaper than downloading the file to CRC it locally, anyway)

that I’m puzzled that there doesn’t seem to be an easy way to get it (unless I’m missing something obvious).


#2

$ crc32 [filename]

Maximum Cash Discount on any plan with MAXCASH

How To Install PHP.INI / ionCube on DreamHost


#3

Thanks … but I should have been more specific in my question,

what I’m hoping to do is, as the account owner, check the CRC of a file uploaded by one of my users.

I could log in as that user, of course, but that doesn’t help if it’s an FTP-only user.


#4

You could write a script that performs the operations you need and upload it into the userspace.

Maximum Cash Discount on any plan with MAXCASH

How To Install PHP.INI / ionCube on DreamHost


#5

Cripes! Thanks for your answer, but please bear in mind that this is a beginner’s forum! (And I am a beginner, obviously)

Surely, as account owners, we are basically responsible for any content uploaded by our users.

So surely, we need to be able to check the integrity of that content.

Are you saying (and it seems that as a “Pooh-Bah” you are in some kind of position of responsibility) that to check the integrity of my users’ uploads I need to write some kind of script thingy?


#6

In order to run shell commands interactively you’ll need to allow shell access to the user and SSH in with their credentials. A script of some description could be written to do the same without needing to log into the server as it would be run with the user’s priviledges by default.

The “Pooh-Bah” status basically indicates that I’m a post foo.

Maximum Cash Discount on any plan with MAXCASH

How To Install PHP.INI / ionCube on DreamHost


#7

Here’s something you can plug into the cronjob section of the panel:

/usr/bin/crc32 ~/EXAMPLE.COM/UPLOADS/*

Set to run as the desired user (dropdown menu). The ~ means it’ll look in that user’s directory. Change the EXAMPLE.COM/etc stuff so it’s the proper directory.

Have it run hourly, or daily, or whatever. Have it set to email you the results.

This is the easiest way to accomplish this beyond doing more complex scripting. If you end up with a ton of files, this will no longer be practical, as it’ll keep checking the same stuff over and over again, plus whatever is new.

-Scott


#8

Thanks, but …

[quote]Set to run as the desired user (dropdown menu).

[/quote]

the dropdown menu only lists the users that have shell access … so it seems that shell access is needed, not only for interactive shell commands, but for cron job actions … is that right?

So, is it the case that there’s nothing that we can do with files in the userspace of our ftp-only users, except to download or delete them?


#9

With some careful PHP scripting, I’m sure it could be done.

-Scott


#10

Options:

  1. Set the user to have shell access.

  2. Temporarily set the user to have shell access when required.

  3. Have a script perform the shell operation (FTP Only access is fine).

Maximum Cash Discount on any plan with MAXCASH

How To Install PHP.INI / ionCube on DreamHost


#11

Just to mention how I solved this problem, I logged in (using PUTTY) as one of my users that has shell access, and from there I ran FTP to log in as the FTP-only user, and ran GET to obtain the file, then quit from FTP and ran CRC32

Probably that’s what you were telling me to do, but all this talk of “scripts” threw me off